Kubernetes not returning endpoints Django Rest-Framework

8/6/2018

Hey guys i have a django rest application and every time that i expose the deployment with service, my minikube doesn't expose the IP, anyone knows how to solved it? I wait 3 hours and my minikube doesn't show any IP.

Pod/container log:

<django.db.models.fields.related.ForeignKey>
<django.db.models.fields.TextField>
<django.db.models.fields.related.ForeignKey>
Operations to perform:
  Apply all migrations: admin, auth, authtoken, chat, contenttypes, notifications, sessions
Running migrations:
  No migrations to apply.
<django.db.models.fields.related.ForeignKey>
<django.db.models.fields.TextField>
<django.db.models.fields.related.ForeignKey>
<django.db.models.fields.related.ForeignKey>
<django.db.models.fields.TextField>
<django.db.models.fields.related.ForeignKey>
Performing system checks...
 System check identified no issues (0 silenced).
August 06, 2018 - 19:14:37
Django version 2.0.1, using settings 'chatire.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C

backend-service:

apiVersion: v1
kind: Service
metadata:
  name: backend-service
spec:
  type: NodePort
  ports:
    - port: 8000
      nodePort: 30001
  selector:
    service: backend-pod

backend-deployment:

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: backend-deployment
spec:
  template:
    metadata:
      labels:
       name: backend-pod
    spec:
      containers:
        - name: container-backend
          image: modalgr.azurecr.io/chatbot/backend:v1.1
          ports:
          - containerPort: 8000
          command: ["/bin/sh"]
          args: ["app.sh"]
      restartPolicy: Always
      imagePullSecrets:
      - name: azure-auth

Error log:

C:\Users\Youssef\Documents\kubernetes>minikube service backend-service | findstr IP
Waiting, endpoint for service is not ready yet...
Waiting, endpoint for service is not ready yet...
Waiting, endpoint for service is not ready yet...
Waiting, endpoint for service is not ready yet...
-- Daniel Pereira
django
django-rest-framework
docker
kubernetes

1 Answer

8/7/2018

The error Waiting, endpoint for service is not ready yet... means that your Service can’t find your Pod.

It happens because the label name in Service does not match the label name in Deployment.

To fix this issue you should change name: backend-pod to service: backend-pod in Deployment.

-- Akar
Source: StackOverflow