====== Headline ====== --- apiVersion: apps/v1 kind: Deployment metadata: name: nginx-deployment labels: app: nginx app.kubernetes.io/name=nginx # used spec: replicas: 3 selector: # field defines how the created ReplicaSet finds which Pods to manage. In this case, you select a label that is defined in the Pod template (app: nginx). matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - name: nginx image: nginx:1.14.2 ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: my-service spec: selector: app.kubernetes.io/name: MyApp ports: - protocol: TCP port: 80 targetPort: 9376