Skip to content

Instantly share code, notes, and snippets.

@imjasonh
Last active October 28, 2021 06:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save imjasonh/6a0d8e0c0b11cda095f30c4890072d73 to your computer and use it in GitHub Desktop.
Save imjasonh/6a0d8e0c0b11cda095f30c4890072d73 to your computer and use it in GitHub Desktop.
Repro pod that fails to start since init container isn't found
Warning FailedMount 1m (x8 over 2m) kubelet, gke-cluster-1-default-pool-f1d9d3b1-x598 MountVolume.SetUp failed for volume "podinfo-init" : container init not found
Warning FailedMount 3s kubelet, gke-cluster-1-default-pool-f1d9d3b1-x598 Unable to mount volumes for pod "pod_default(bdca098f-7b0a-11e8-b5dd-42010a8e007f)": timeout expired waiting for volumes to attach or mount for pod "default"/"pod". list of unmounted volumes=[podinfo-init]. list of unattached volumes=[podinfo-init podinfo-real default-token-pkttv]
apiVersion: v1
kind: Pod
metadata:
name: pod
spec:
restartPolicy: Never
initContainers:
- name: init
image: ubuntu
args: ['cat', '/etc/podinfo/cpu']
resources:
requests:
cpu: '.25'
limits:
cpu: '.25'
volumeMounts:
- name: podinfo-init
mountPath: /etc/podinfo
containers:
- name: real
image: ubuntu
args: ['cat', '/etc/podinfo/cpu']
resources:
requests:
cpu: '.25'
limits:
cpu: '.25'
volumeMounts:
- name: podinfo-real
mountPath: /etc/podinfo
volumes:
- name: podinfo-init
downwardAPI:
items:
- path: 'cpu'
resourceFieldRef:
containerName: 'init'
resource: 'requests.cpu'
- name: podinfo-real
downwardAPI:
items:
- path: 'cpu'
resourceFieldRef:
containerName: 'real'
resource: 'requests.cpu'
apiVersion: v1
kind: Pod
metadata:
name: projected
spec:
restartPolicy: Never
initContainers:
- name: init
image: ubuntu
args: ['cat', '/etc/podinfo/cpu']
resources:
requests:
cpu: '.25'
limits:
cpu: '.25'
volumeMounts:
- name: podinfo-init
mountPath: /etc/podinfo
containers:
- name: real
image: ubuntu
args: ['cat', '/etc/podinfo/cpu']
resources:
requests:
cpu: '.25'
limits:
cpu: '.25'
volumeMounts:
- name: podinfo-real
mountPath: /etc/podinfo
volumes:
- name: podinfo-init
projected:
sources:
- downwardAPI:
items:
- path: 'cpu'
resourceFieldRef:
containerName: 'init'
resource: 'requests.cpu'
- name: podinfo-real
projected:
sources:
- downwardAPI:
items:
- path: 'cpu'
resourceFieldRef:
containerName: 'real'
resource: 'requests.cpu'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment