Search code examples
kuberneteskubectl

Kubernetes pod not created for service


I have a Kubernetes service for jenkins-agent.

But as I can see there is no pod created for that service. How can I initiate pod creation from the existing service?

This is how my service configuration looks like:

Name:              ci-jenkins-agent
Namespace:         ci
Labels:            app=ci-jenkins
                   chart=jenkins-0.35.1
                   component=ci-jenkins-master
Annotations:       <none>
Selector:          component=ci-jenkins-master
Type:              ClusterIP
IP:                199.62.116.92
Port:              slavelistener  50000/TCP
TargetPort:        50000/TCP
Endpoints:         <none>
Session Affinity:  None
Events:            <none>

Solution

  • The pods behind a service is decided by matching Selector of service with label of pods. So you need to get the existing pods with the label component=ci-jenkins-master

    kubectl get pods -l component=ci-jenkins-master -n ci -o yaml > pod.yaml
    

    But looking at the service Endpoints does not have any Pod IP which means service does not have any backend pod probably because there is no pod running with label component=ci-jenkins-master