...

/

Create a Service—The Declarative Way

Create a Service—The Declarative Way

Look at the declarative way of creating a Service.

We'll cover the following...

It’s time to do things the proper way — the Kubernetes way.

A Service manifest file

The following YAML is from the lb.yml file, and we’ll use it to deploy a LoadBalancer Service declaratively.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: svc-test
spec:
  replicas: 10
  selector:
    matchLabels:
      chapter: services
  template:
    metadata:
      labels:
        chapter: services
    spec:
      containers:
      - name: hello-ctr
        image: nigelpoulton/k8sbook:1.0
        ports:
        - containerPort: 8080
Playground

Let’s go through it. ...