Roshan Ranasinghe:
Hi Guys , can some one help me to find the answer for last Question 07 in Lightning Lab - 1…
Create a pod called secret-1401
in the admin1401
namespace using the busybox
image. The container within the pod should be called secret-admin
and should sleep for 4800
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
.
pls check the below yaml and correct it pls…
apiVersion: v1kind: Pod
metadata:
creationTimestamp: null
labels:
run: secret-1401
name: secret-1401
spec:
containers:
- image: busybox
name: secret-admin
command: [“sleep”,“4800”]
volumeMounts:
- mountPath: “/etc/secret-volume”
name: secret-volume
volumes:
- name: secret-volume
type: Secret
secretName: dotfile-secret
Tej_Singh_Rana:
Hello, @Roshan Ranasinghe
secret volumes should be in correct format.
volumes:
- name: secret-volume
secret:
secretName: secret-name
Roshan Ranasinghe:
Thanks @Tej_Singh_Rana …it works
Tej_Singh_Rana:
Please bookmark this page.
https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets
OR
Run the command:
kubectl explain pod.spec.volumes.secret
Multiple scenarios available in the k8s official docs. Please try in the lab.
Roshan Ranasinghe:
great .thank you
Francesco:
missing also namespace admin1401
Tej_Singh_Rana:
Hello, @Francesco
You can deploy in specific namespace by running below command:
$ kubectl create -f file.yaml -n admin1401
But its good to specify in same definition file.
Francesco:
@Tej_Singh_Rana Hi, my answer was to @Roshan Ranasinghe because the question 07 in Lightning Lab - 1 requires the namespace admin1401
Anyway thank you all the same.
Roshan Ranasinghe:
Thanks @Francesco… yep… resolve the issue … here is the corrected one…
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
run: secret-1401
name: secret-1401
namespace: admin1401
spec:
containers:
- image: busybox
name: secret-admin
command: [“sleep”,“4800”]
volumeMounts:
- mountPath: “/etc/secret-volume”
name: secret-volume
readOnly: true
volumes:
- name: secret-volume
secret:
secretName: dotfile-secre