k8s service basic - service selector

 what happens if your service selector doesn't match any of your deployment/pod label? 

There won't be any endpoints visbile


In terms of selector, either one match would be sufficient. For example, this is your deployment label


 template:
    metadata:
      labels:
        app: httpbin
        version: v1
        apptype: backend

So your service selector, just need to be either one: 

spec:
  ports:
  - name: http
    port: 8000
    targetPort: 80
  selector:
    #app: httpbin
    #apptype: backend
    version: v1


The same applies to deployment resources. 






Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm