1

I'm trying to deploy my spring boot application to local kubernates cluster. I have performed the below steps 1.created the application build the image and pushed to docker hub registry 2.created the secret and configured 3.created the deployment file and executed But Pod was not getting created as I'm getting containerCreationError in the status .when I checked the logs I can see that image has been successfully pulled but the below error occurs

kublet Error: Error response from daemon: No command specified

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: auth-app-deployment
  labels:
    name: auth-app-deployment
spec:
  replicas: 1
  selector:
    matchLabels:
      name: auth-app
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        name: auth-app
    spec:
      imagePullSecrets:
        - name: regcred
      containers:
        - name: auth-app
          image: vishnusnair1995/vsn-tec:auth
          imagePullPolicy: Always
          ports:
            - containerPort: 9999
          env:
            - name: SPRING_PROFILES_ACTIVE
              value: prod
          livenessProbe:
            httpGet:
              path: /actuator/health
              port: 9999
            initialDelaySeconds: 30
            periodSeconds: 40
          readinessProbe:
            httpGet:
              path: /actuator/health
              port: 9999
            initialDelaySeconds: 30
            periodSeconds: 40
      restartPolicy: Always

     FROM openjdk:8 
     COPY build/libs/auth-0.0.1-SNAPSHOT.jar app.jar 
     ENTRYPOINT ["java","-jar","/app.jar"]

DOCKERFILE

From my understanding the issue is only when we are pulling the image from remote registry, because what I observed is that when I build the docker image in local and change the imagePullPolicy : IfNotPresent pod was getting created with out any issues

  • [Please do not upload images of code/data/errors.](//meta.stackoverflow.com/q/285551) Are you overriding the `command:` in your Kubernetes manifest file? Does the `image:` match what you `docker build` and `docker push`ed? – David Maze Feb 15 '23 at 11:21
  • @DavidMaze No I'm not overridng. Yes the image name matches the one which is pushed – Vishnu s nair Feb 15 '23 at 11:58
  • Can you [edit] the question to include the actual text of the YAML manifest, not a screen shot of your desktop? Please also double-check the syntax of the Dockerfile (it should not have hyphens at the start of the lines). – David Maze Feb 15 '23 at 12:08
  • can u please chk now I have edited it @DavidMaze – Vishnu s nair Feb 15 '23 at 13:19
  • Hello @Vishnu s nair, Feel free to update the status of the question. Let me know the answer below helps to resolve your issue? I am happy to help you if you have any further queries. – Veera Nagireddy Mar 20 '23 at 07:33

1 Answers1

-1

Normally docker checks first locally if the image is present and then tries to connect to a remote repository. The first thing you should do is check the pod’s image field and look for basic mistakes—typos can happen to anyone.

If you change IfNotPresent : The image is only pulled if it’s not already available on the node. This is the default policy when you’ve specified an image tag and it’s not latest.

Kubelet will now be able to reuse the existing image version, letting your containers start. You can revert the change once your registry’s back online, putting you back to pulling the latest image updates on each deploy.

Check your node’s networking could have failed or there might be wider cluster connectivity issues. If you’re online, the registry’s up, and pull errors are persisting, you could be running into firewall or traffic filtering issues.

And the final possibility is hitting rate limits imposed by public registry providers.

If Docker cannot download the base image from the remote registry, check the server’s network connectivity.

Refer to James Walker’s Kubernetes Error Codes: Failed to Pull Image for more info.

Veera Nagireddy
  • 1,656
  • 1
  • 3
  • 12
  • This doesn't seem especially related to this question: there's no mention of any sort of `workerConfig` (that's not a standard Kubernetes name) and the Python Dockerfile isn't relevant to the Java setup in the question. – David Maze Feb 15 '23 at 15:14
  • Yes your right@David Maze, changed my answer. – Veera Nagireddy Feb 21 '23 at 05:59