Hi @juliettet @rahul456 @Tej-Singh-Rana @akshayyw
I have assigned a task to manage secrets in kubernetes.
But I got stuck at one place and can’t even find the solution in official documents too!
The question says:
- We already have a secret key file
official.txtunder/optlocation onjump host. Create asecretnamed asofficialand it should contain the password/license-number present inofficial.txtfile.- Also create a
podnamedsecret-xfusion.- Configure pod’s
specas container name should besecret-container-xfusion, image should befedorapreferably withlatesttag (remember to mention the tag with image). Use command'/bin/bash', ’-c'and'sleep 10000'for container. Mount a volume named assecret-volume-xfusion(volume should not be aprojected volume). The mount path should be/opt/appsand mode should bereadOnly.- Mount the secret within this volume.
- To verify you can exec into the container
secret-container-xfusion, to check the secret key under the mounted path/opt/apps.- Secret type should be
generic.
My code for secret
apiVersion: v1
kind: Secret
metadata:
name: official
stringData:
password: 5ecur3!
My code for pod:
apiVersion: v1
kind: Pod
metadata:
name: secret-xfusion
spec:
volumes:
- name: secret-volume-xfusion
projected:
sources:
- secret:
name: secret-xfusion
containers:
- name: secret-container-xfusion
image: fedora:latest
command: ['/bin/bash', '-c', 'sleep 10000']
volumeMounts:
- mountPath: "/opt/apps"
name: secret-volume-xfusion
readOnly: true
As I execute
kubectl get pods, it got stuck at “container creating” state and I don’t get what actually the question is trying to say? The volume should “NOT” be projected!???
Kindly look into this!!
Links which I am referring to