자격증/CKA

[CKA] Udemy Lightning Lab (5/7)

14ben 2024. 7. 25. 23:22
728x90
A new deployment called alpha-mysql has been deployed in the alpha namespace. 
However, the pods are not running. 
Troubleshoot and fix the issue. 
The deployment should make use of the persistent volume alpha-pv to be mounted at 
/var/lib/mysql and should use the environment variable 
MYSQL_ALLOW_EMPTY_PASSWORD=1 to make use of an empty root password.


- Important: Do not alter the persistent volume.

- Troubleshoot and fix the issues

 

 

controlplane ~ ➜  k get pods -n alpha 
NAME                          READY   STATUS    RESTARTS   AGE
alpha-mysql-5b944d484-md6lf   0/1     Pending   0          5m13s


controlplane ~ ✖ k describe -n alpha pod alpha-mysql-5b944d484-md6lf
...
..
.
Events:
  Type     Reason            Age                  From               Message
  ----     ------            ----                 ----               -------
  Warning  FailedScheduling  14s (x2 over 5m32s)  default-scheduler  0/2 nodes are available: persistentvolumeclaim "mysql-alpha-pvc" not found. preemption: 0/2 nodes are available: 
                                                                     2 Preemption is not helpful for scheduling.

controlplane ~ ➜  k get pvc -n alpha 
NAME          STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   VOLUMEATTRIBUTESCLASS   AGE
alpha-claim   Pending                                      slow-storage   <unset>                 5m46s

 

 

controlplane ~ ➜  k get pvc -n alpha alpha-claim -o yaml > pvc.yaml

# pvc 상태 확인 : mysql-alpha-pvc가 목록에 없다.
$ k get pvc -n alpha 
NAME          STATUS    VOLUME   CAPACITY   ACCESS MODES   STORAGECLASS   AGE
alpha-claim   Pending                                      slow-storage   41m


# pvc.yaml 작성
$ cat pvc.yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: mysql-alpha-pvc
  namespace: alpha
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi
  storageClassName: slow

 

controlplane ~ ➜  k apply -f pvpv.yaml 
The PersistentVolumeClaim "mysql-alpha-pvc" is invalid: 
* spec: Forbidden: spec is immutable after creation except resources.requests and volumeAttributesClassName for bound claims
  core.PersistentVolumeClaimSpec{
-       AccessModes: []core.PersistentVolumeAccessMode{"ReadWriteMany"},
+       AccessModes: []core.PersistentVolumeAccessMode{"ReadWriteOnce"},
        Selector:    nil,
        Resources: core.VolumeResourceRequirements{
                Limits: nil,
-               Requests: core.ResourceList{
-                       s"storage": {i: resource.int64Amount{value: 2147483648}, s: "2Gi", Format: "BinarySI"},
-               },
+               Requests: core.ResourceList{
+                       s"storage": {i: resource.int64Amount{value: 1073741824}, s: "1Gi", Format: "BinarySI"},
+               },
        },
        VolumeName:       "",
        StorageClassName: &"slow",
        ... // 4 identical fields
  }

* spec.resources.requests.storage: Forbidden: field can not be less than previous value

 

이건 또 왜 안되냐 ...

728x90

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

[CKA] Udemy Lightning Lab (7/7)  (0) 2024.07.29
[CKA] Udemy Lightning Lab (6/7)  (0) 2024.07.29
[CKA] Udemy Lightning Lab (4/7)  (0) 2024.07.24
[CKA] Udemy Lightning Lab (3/7)  (0) 2024.07.24
[CKA] Udemy Lightning Lab (2/7)  (2) 2024.07.22