Google News
logo
Kubernetes - Interview Questions
How service that selects apps based on the label and has an externalIP?
The service selects apps based on labels, so if no pods have appropriate labels, the service has nothing to route and labels can be anything you like. Since all pod names should be unique, you can just set the labels as the pod name. Since statesets create the same pods multiple times, they won't be configured with distinct labels you could use to point disparate services to the correct pod. If you gave the pods their own labels manually it will work. Also, service selects pods based on selector as well their location label as well Below .yaml file of Grafana dashboard service shows the same
 
* apiVersion: v1
* kind: Service

metadata :
* name: grafanaportforward
* namespace: kubeflow

labels :
* run: grafana-test

spec :
 
ports :
* - port: 3000
* protocol: TCP
* name: grafana
* externalIPs:- x.y.x.q
* selector:app: grafana-test
Advertisement