1. A pod definition file nginx.yaml is given. Create a pod using the file.
Only create the POD for now. We will inspect its status next.
$ controlplane ~ ➜ k apply -f nginx.yaml
pod/nginx created
2. What is the status of the created POD?
$ controlplane ~ ➜ k get pods
NAME READY STATUS RESTARTS AGE
nginx 0/1 Pending 0 31s
answer : Pending
3. Why is the POD in a pending state?
Inspect the environment for various kubernetes control plane components.
$ controlplane ~ ➜ k get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-69f9c977-hj2nb 1/1 Running 0 6m24s
coredns-69f9c977-xj8c9 1/1 Running 0 6m23s
etcd-controlplane 1/1 Running 0 6m35s
kube-apiserver-controlplane 1/1 Running 0 6m42s
kube-controller-manager-controlplane 1/1 Running 0 6m35s
kube-proxy-29dhc 1/1 Running 0 6m24s
kube-proxy-phjtj 1/1 Running 0 5m59s
동작중인 kube-scheduler 가없다. 보통은 kube-scheduler를 통해 노드를 자동으로 배정해 주지만 현재 실습 환경에서는 scheduler가없기 때문에 node 를 직접 명시해 주어 pod를 실행시켜야 한다.
https://kubernetes.io/docs/reference/command-line-tools-reference/kube-scheduler/
kube-scheduler
Synopsis The Kubernetes scheduler is a control plane process which assigns Pods to Nodes. The scheduler determines which Nodes are valid placements for each Pod in the scheduling queue according to constraints and available resources. The scheduler then ra
kubernetes.io
Synopsis
The Kubernetes scheduler is a control plane process which assigns Pods to Nodes.
kube-scheduler 가 없으면 pods 를 실행해도 노드에 배치해 줄수 없다.
answer : No Scheduler Present
4. Manually schedule the pod on node01.
Delete and recreate the POD if necessary.
$ controlplane ~ ➜ k delete po nginx
pod "nginx" deleted
## in nginx.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
nodeName: node01
containers:
- image: nginx
name: nginx
-------
$ controlplane ~ ➜ k apply -f nginx.yaml
pod/nginx created
5. Now schedule the same pod on the controlplane node.
Delete and recreate the POD if necessary.
$ controlplane ~ ➜ k delete po nginx
pod "nginx" deleted
## in nginx.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
nodeName: controlplane
containers:
- image: nginx
name: nginx
-------
$ controlplane ~ ➜ k apply -f nginx.yaml
pod/nginx created
'IT 기술 > k8s' 카테고리의 다른 글
[cka] Taints and Tolerations (0) | 2024.06.08 |
---|---|
[cka] Labels and Selectors (0) | 2024.06.08 |
[cka] Imperative Command (1) | 2024.06.01 |
[cka] Services (0) | 2024.06.01 |
[cka] namespace (1) | 2024.05.28 |
댓글