May 2018
Intermediate to advanced
554 pages
13h 51m
English
As of Kubernetes version 1.9, Service only supports the equality-based selector to bind to Pods or ReplicaSet.
Let's create one Service that binds to nginx, which belongs to the production environment and the pilot project. Remember that nginx also belongs to the frontend tier:
//check your selector filter is correct or not$ kubectl get pods -l 'environment=production,project=pilot,tier=frontend'NAME READY STATUS RESTARTS AGEpilot.prod.nginx 1/1 Running 0 19m//create Service yaml that specify selector$ cat pilot-nginx-svc.yaml apiVersion: v1kind: Servicemetadata: name: pilot-nginx-svcspec: type: NodePort ports: - protocol: TCP port: 80 selector: project: pilot environment: production ...