Hey folks. I am preparing for my CKA which is Today. Why do I have an error in lab 7?
“Correct” answer is
---
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: secret-1401
name: secret-1401
namespace: admin1401
spec:
volumes:
- name: secret-volume
# secret volume
secret:
secretName: dotfile-secret
containers:
- command:
- sleep
- "4800"
image: busybox
name: secret-admin
# volumes' mount path
volumeMounts:
- name: secret-volume
readOnly: true
mountPath: "/etc/secret-volume"
My answer is
apiVersion: v1
kind: Pod
metadata:
labels:
run: secret-1401
name: secret-1401
namespace: admin1401
spec:
containers:
- command:
- sleep
- "4800"
image: busybox
volumeMounts:
- name: secret-volume
mountPath: /etc/secret-volume
readOnly: true
name: secret-1401
volumes:
- name: secret-volume
secret:
secretName: dotfile-secret
Can someone enlighten me?
Cheers,
Wojciech
Pod is healthy and running
controlplane ~ ➜ k describe po -n admin1401 secret-1401
Name: secret-1401
Namespace: admin1401
Priority: 0
Service Account: default
Node: controlplane/192.15.184.11
Start Time: Fri, 29 Mar 2024 06:19:52 -0400
Labels: run=secret-1401
Annotations: <none>
Status: Running
IP: 10.244.0.4
IPs:
IP: 10.244.0.4
Containers:
secret-1401:
Container ID: containerd://545f6bc30f83a37f8e538189c43d0db7d44217a28bc40320e84a83380fb9056c
Image: busybox
Image ID: docker.io/library/busybox@sha256:c3839dd800b9eb7603340509769c43e146a74c63dca3045a8e7dc8ee07e53966
Port: <none>
Host Port: <none>
Command:
sleep
4800
State: Running
Started: Fri, 29 Mar 2024 06:19:54 -0400
Ready: True
Restart Count: 0
Environment: <none>
Mounts:
/etc/secret-volume from secret-volume (ro)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-cglmx (ro)
Conditions:
Type Status
PodReadyToStartContainers True
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
secret-volume:
Type: Secret (a volume populated by a Secret)
SecretName: dotfile-secret
Optional: false
kube-api-access-cglmx:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 14s default-scheduler Successfully assigned admin1401/secret-1401 to controlplane
Normal Pulling 13s kubelet Pulling image "busybox"
Normal Pulled 12s kubelet Successfully pulled image "busybox" in 1.428s (1.429s including waiting)
Normal Created 12s kubelet Created container secret-1401
Normal Started 12s kubelet Started container secret-1401
The problem specifies: “The container within the pod should be called secret-admin
and should sleep for 4800
seconds.” Since your container is instead called “secret-1401”, the grader is unhappy