자격증/CKA

[CKA] Udemy Lightning Lab (7/7)

14ben 2024. 7. 29. 23:11
728x90
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.


- Pod created correctly?

 

# 완성
apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null
  labels:
    run: secret-1401
  name: secret-1401
  namespace: admin1401
spec:
  containers:
  - image: busybox
    name: secret-1401
    command: ['sh', '-c','sleep 4800']
    resources: {}
  dnsPolicy: ClusterFirst
  restartPolicy: Always
status: {}


# 생성
k apply -f bosy.yaml -n admin1401
pod/secret-1401 created

controlplane /opt ✖ k get pods -n admin1401
NAME          READY   STATUS    RESTARTS   AGE
secret-1401   1/1     Running   0          24s

 

 

흠 ... 틀림

 

답지

kubectl run secret-1401 -n admin1401 --image=busybox --dry-run=client -oyaml\
--command -- sleep 4800 > admin.yaml

 

Add the secret volume and mount path to create a pod called secret-1401 in the admin1401 namespace as follows:

---
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"
728x90

'자격증 > CKA' 카테고리의 다른 글

Udemy Mock Exam - 2  (0) 2024.08.25
Udemy Mock Exam - 1  (0) 2024.07.30
[CKA] Udemy Lightning Lab (6/7)  (0) 2024.07.29
[CKA] Udemy Lightning Lab (5/7)  (0) 2024.07.25
[CKA] Udemy Lightning Lab (4/7)  (0) 2024.07.24