Mohit Tayal:
Hi Guys need suggestion on one lab question:
question :
Create a pod called my-busybox
in the dev2406
namespace using the busybox
image. The container should be called secret
and should sleep for 3600
seconds.
The container should mount a read-only
secret volume called secret-volume
at the path /etc/secret-volume
. The secret being mounted has already been created for you and is called dotfile-secret
.
Make sure that the pod is scheduled on master/controlplane
and no other node in the cluster.
yaml created :
controlplane $ cat secret.yaml
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
name: my-busybox
namespace: dev2406
spec:
nodeName: master
containers:
- command:
- sleep 3600
image: busybox
name: secret
volumeMounts:
- name: secret-volume
readOnly: true
mountPath: "/etc/secret-volume"
volumes:
- name: secret-volume
secret:
secretName: dotfile-secret
restartPolicy: Never
When i am creating it , its status is showing pending only not going into running mode and after sometime automatically exists.
controlplane $ kubectl get pods --all-namespaces | grep -i my-busybox
dev2406 my-busybox 0/1 Pending 0 28s
controlplane $
controlplane $
controlplane $
controlplane $
controlplane $ kubectl get pods --all-namespaces | grep -i my-busybox
dev2406 my-busybox 0/1 Pending 0 37s
controlplane $
Describe output of the created pod.
controlplane $ kubectl -n dev2406 describe pod my-busybox
Name: my-busybox
Namespace: dev2406
Priority: 0
Node: master/
Labels: <none>
Annotations: <none>
Status: Pending
IP:
IPs: <none>
Containers:
secret:
Image: busybox
Port: <none>
Host Port: <none>
Command:
sleep 3600
Environment: <none>
Mounts:
/etc/secret-volume from secret-volume (ro)
/var/run/secrets/kubernetes.io/serviceaccount from default-token-5trqm (ro)
Volumes:
secret-volume:
Type: Secret (a volume populated by a Secret)
SecretName: dotfile-secret
Optional: false
default-token-5trqm:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-5trqm
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: <http://node.kubernetes.io/not-ready:NoExecute|node.kubernetes.io/not-ready:NoExecute> op=Exists for 300s
<http://node.kubernetes.io/unreachable:NoExecute|node.kubernetes.io/unreachable:NoExecute> op=Exists for 300s
Events: <none>
controlplane $
controlplane $ kubectl get pods --all-namespaces | grep -i my-busybox
controlplane $
Can someone please assist, what i am doing wrong here ??