Confusion in Manage Secrets in Kubernetes tasks

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:

  1. We already have a secret key file official.txt under /opt location on jump host . Create a secret named as official and it should contain the password/license-number present in official.txt file.
  2. Also create a pod named secret-xfusion .
  3. Configure pod’s spec as container name should be secret-container-xfusion , image should be fedora preferably with latest tag (remember to mention the tag with image). Use command '/bin/bash' , ’ -c' and 'sleep 10000' for container. Mount a volume named as secret-volume-xfusion (volume should not be a projected volume ). The mount path should be /opt/apps and mode should be readOnly .
  4. Mount the secret within this volume.
  5. To verify you can exec into the container secret-container-xfusion , to check the secret key under the mounted path /opt/apps .
  6. Secret type should be generic .

My code for secret

apiVersion: v1
kind: Secret
  name: official
  password: 5ecur3!

My code for pod:

apiVersion: v1
kind: Pod
  name: secret-xfusion
     - name: secret-volume-xfusion
          - secret:
              name: secret-xfusion
     - name: secret-container-xfusion
       image: fedora:latest
       command: ['/bin/bash', '-c', 'sleep 10000']
         - 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

Hi @Ashu27

Sorry for the confusion, we have updated the question a bit, please try now.


Completed the task!
Thanks @Inderpreet