Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pod stuck at ContainerCreating when given an invalid Pod definition #88166

Open
campoy opened this issue Feb 14, 2020 · 1 comment
Open

Pod stuck at ContainerCreating when given an invalid Pod definition #88166

campoy opened this issue Feb 14, 2020 · 1 comment

Comments

@campoy
Copy link

@campoy campoy commented Feb 14, 2020

What happened:

I created a pod with a downwardAPI volume where I exposed a resourceFieldRef with a containerName that didn't match the name of any of the containers in the pod.

I would have expected this to fail the container creation.
Instead, it just got stuck indefinitely.

What you expected to happen:

I would have expected the pod to fail to create and a clear error to appear somewhere.

Instead, the pod creation gets stuck in ContainerCreating:

➜  k get pods
NAME              READY   STATUS              RESTARTS   AGE
downwardapi-pod   0/1     ContainerCreating   0          7m8s

note: even after 7 minutes the container is still "creating"

Describing the pod shows the warning that allowed me to understand the issue:

Events:
  Type     Reason       Age               From                                           Message
  ----     ------       ----              ----                                           -------
  Normal   Scheduled    20s               default-scheduler                              Successfully assigned default/downwardapi-pod to gke-kubecluster-pool-1-edf7fa06-r2f4
  Warning  FailedMount  4s (x6 over 20s)  kubelet, gke-kubecluster-pool-1-edf7fa06-r2f4  MountVolume.SetUp failed for volume "podinfo" : container not-a-container not found

How to reproduce it (as minimally and precisely as possible):

Create this pod:

apiVersion: v1
kind: Pod
metadata:
  name: downwardapi-pod

spec:
  containers:
  - name: sleepy
    image: alpine
    command: ["/bin/sh", "-c", "--"]
    args: ["while true; do sleep 300; done"]
    volumeMounts:
    - name: podinfo
      mountPath: /etc/podinfo
  
  volumes:
  - name: podinfo
    downwardAPI:
      items:
      - path: "cpu_limit"
        resourceFieldRef:
          containerName: not-a-container
          resource: limits.cpu
          divisor: 1m

Anything else we need to know?:

Environment:

  • Kubernetes version (use kubectl version):

Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.5", GitCommit:"20c265fef0741dd71a66480e35bd69f18351daea", GitTreeState:"clean", BuildDate:"2019-10-15T19:16:51Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"15+", GitVersion:"v1.15.9-gke.8", GitCommit:"a9973cbb2722793e2ea08d20880633ca61d3e669", GitTreeState:"clean", BuildDate:"2020-02-07T00:50:57Z", GoVersion:"go1.12.12b4", Compiler:"gc", Platform:"linux/amd64"}

  • Cloud provider or hardware configuration:

Tried on GKE and Docker for Mac

  • OS (e.g: cat /etc/os-release):

macOS Catalina 10.15.2

  • Kernel (e.g. uname -a):
  • Install tools:
  • Network plugin and version (if this is a network-related bug):
  • Others:
@campoy

This comment has been minimized.

Copy link
Author

@campoy campoy commented Feb 14, 2020

/sig usability

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.