작성
·
117
0
질문 답변을 제공하지만, 강의 비용에는 Q&A는 포함되어 있지 않습니다.
다만 실습이 안되거나, 잘못된 내용의 경우는 알려주시면 가능한 빠르게 조치하겠습니다!
[질문 전 답변]
1. 강의에서 다룬 내용과 관련된 질문인가요? 예
2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예
3. 질문 잘하기 법을 읽어보셨나요? 예
(https://www.inflearn.com/blogs/1719)
4. 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.
5. vagrant up
에서 발생하는 문제는 주로 호스트 시스템(Windows, MacOS)과 연관된 다양한 조건에 의해 발생합니다. 따라서 이를 모두 제가 파악할 수 없어서 해결이 어렵습니다. vagrant up으로 진행이 어렵다면 제공해 드리는 가상 머신(VM) 이미지를 import해서 진행하시기 바랍니다.
(https://www.inflearn.com/questions/992407/comment/281901)
[질문 하기]
window환경에서 vagrant up은 정상적으로 실행되었고 tabby로 cp에 접속해서 실습을 진행하다가 보니 pod상태가 변경이 안되서 문의드립니다.
apply 실행 후 pod상태가 ContainerCreating 에서 변경되지 않습니다.
해결 방법이 있을까요?
root@cp-k8s:~/_Lecture_k8s_learning.kit/ch3/3.6# k get po
NAME READY STATUS RESTARTS AGE
nginx 0/1 ContainerCreating 0 78s
root@cp-k8s:~/_Lecture_k8s_learning.kit/ch3/3.6# k describe pods
Name: nginx
Namespace: default
Priority: 0
Service Account: default
Node: w3-k8s/192.168.1.103
Start Time: Fri, 10 Jan 2025 22:02:30 +0900
Labels: run=nginx
Annotations:
Status: Pending
IP:
IPs:
Containers:
nginx:
Container ID:
Image: nginx
Image ID:
Port:
Host Port:
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-44v7r (ro)
Conditions:
Type Status
PodReadyToStartContainers False
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-44v7r:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m10s default-scheduler Successfully assigned default/nginx to w3-k8s
Warning FailedCreatePodSandBox 2m11s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for
sandbox "b57c40549808d64a9c6fd2406bca31e347e84b2374864bcf2ad408be2d761174": plugin type="calico" failed (add): error getting ClusterInformation: connection is unaut
horized: Unauthorized
Normal SandboxChanged 5s (x11 over 2m10s) kubelet Pod sandbox changed, it will be killed and re-created.
root@cp-k8s:~/_Lecture_k8s_learning.kit/ch3/3.6# k get po
NAME READY STATUS RESTARTS AGE
nginx 0/1 ContainerCreating 0 4m16s
root@cp-k8s:~/_Lecture_k8s_learning.kit/ch3/3.6# k describe pods
Name: nginx
Namespace: default
Priority: 0
Service Account: default
Node: w3-k8s/192.168.1.103
Start Time: Fri, 10 Jan 2025 22:02:30 +0900
Labels: run=nginx
Annotations:
Status: Pending
IP:
IPs:
Containers:
nginx:
Container ID:
Image: nginx
Image ID:
Port:
Host Port:
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-44v7r (ro)
Conditions:
Type Status
PodReadyToStartContainers False
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
kube-api-access-44v7r:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 4m18s default-scheduler Successfully assigned default/nginx to w3-k8s
Warning FailedCreatePodSandBox 4m18s kubelet Failed to create pod sandbox: rpc error: code = Unknown desc = failed to setup network for
sandbox "b57c40549808d64a9c6fd2406bca31e347e84b2374864bcf2ad408be2d761174": plugin type="calico" failed (add): error getting ClusterInformation: connection is unaut
horized: Unauthorized
Normal SandboxChanged 1s (x21 over 4m17s) kubelet Pod sandbox changed, it will be killed and re-created.
답변 2
0
안녕하세요
AI 인턴에 써준 부분에 답이 있긴 한데 너무 모든 가능성을 다 적어서 보기 어려우실 것 같네요.
현재 적어주신 describe 부분에서 CNI를 담당하는 calico 부분에 이슈가 있으신거 같습니다.
우선 조치 방법은 다음과 같고, 계속 발생하는 이슈라면 발생 조건을 알아야 할 것 같습니다.
k rollout restart ds -n kube-system calico-node
혹시 위의 작업을 진행하시고, 재현 조건을 확인하시면 안내 부탁드려도 될까요?
재현 조건만 알면 저희쪽에서 재현해서 완전하게 해결해 놓도록 하겠습니다!
감사합니다.
잘되는것 같다가 확인해보니 calico-node 1개만 에러가 발생하고 있습니다. 재시작해도 1개만 계속적으로 에러가 발생하는데 해결 방법이 있을까요?
root@cp-k8s:~/_Lecture_k8s_learning.kit/ch4# k get po --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-6cdb97b867-jtvjp 1/1 Running 4 (16m ago) 3d2h
kube-system calico-node-5cwmq 1/1 Running 0 15m
kube-system calico-node-jhf5x 0/1 Init:Error 1 (8s ago) 12s
kube-system calico-node-zx7gz 1/1 Running 0 15m
kube-system coredns-7db6d8ff4d-ggkws 1/1 Running 4 (16m ago) 3d2h
kube-system coredns-7db6d8ff4d-hznqk 1/1 Running 4 (16m ago) 3d2h
kube-system etcd-cp-k8s 1/1 Running 5 (16m ago) 3d2h
kube-system kube-apiserver-cp-k8s 1/1 Running 5 (16m ago) 3d2h
kube-system kube-controller-manager-cp-k8s 1/1 Running 5 (16m ago) 3d2h
kube-system kube-proxy-f89z6 1/1 Running 2 (13m ago) 3d1h
kube-system kube-proxy-r4xmx 1/1 Running 3 (16m ago) 3d2h
kube-system kube-proxy-vdc8f 1/1 Running 4 (16m ago) 3d2h
kube-system kube-scheduler-cp-k8s 1/1 Running 5 (16m ago) 3d2h
metallb-system controller-59ff6ffb57-h55dn 1/1 Running 1 (13m ago) 19h
metallb-system speaker-86slr 1/1 Running 2 (15m ago) 19h
metallb-system speaker-g2rj9 1/1 Running 2 (15m ago) 19h
metallb-system speaker-ll75p 1/1 Running 2 (13m ago) 19h
상세 메시지
root@cp-k8s:~/_Lecture_k8s_learning.kit/ch4# k describe pod calico-node-jhf5x -n kube-system
Name: calico-node-jhf5x
Namespace: kube-system
Priority: 2000001000
Priority Class Name: system-node-critical
Service Account: calico-node
Node: w1-k8s/192.168.1.101
Start Time: Sun, 12 Jan 2025 20:18:15 +0900
Labels: controller-revision-hash=5dcffbd99d
k8s-app=calico-node
pod-template-generation=9
Annotations: kubectl.kubernetes.io/restartedAt: 2025-01-12T20:18:15+09:00
Status: Pending
IP: 192.168.1.101
IPs:
IP: 192.168.1.101
Controlled By: DaemonSet/calico-node
Init Containers:
upgrade-ipam:
Container ID: containerd://1f58a498c45593236829168d27bf12ae6ecab411ec21b5056988e19a984b781b
Image: docker.io/calico/cni:v3.26.0
Image ID: docker.io/calico/cni@sha256:c7c80d82dc4f85ac4d7f2345c940bc7f818bbea03c2043df89923c032d8ee7fc
Port:
Host Port:
Command:
/opt/cni/bin/calico-ipam
-upgrade
State: Terminated
Reason: Completed
Exit Code: 0
Started: Sun, 12 Jan 2025 20:18:16 +0900
Finished: Sun, 12 Jan 2025 20:18:16 +0900
Ready: True
Restart Count: 0
Environment Variables from:
kubernetes-services-endpoint ConfigMap Optional: true
Environment:
KUBERNETES_NODE_NAME: (v1:spec.nodeName)
CALICO_NETWORKING_BACKEND: Optional: false
Mounts:
/host/opt/cni/bin from cni-bin-dir (rw)
/var/lib/cni/networks from host-local-net-dir (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-qkrds (ro)
install-cni:
Container ID: containerd://240e5e317f7efa2cad840792074895e2610c422b94839e1f5d1ba91e88e8eaf6
Image: docker.io/calico/cni:v3.26.0
Image ID: docker.io/calico/cni@sha256:c7c80d82dc4f85ac4d7f2345c940bc7f818bbea03c2043df89923c032d8ee7fc
Port:
Host Port:
Command:
/opt/cni/bin/install
State: Terminated
Reason: Completed
Exit Code: 0
Started: Sun, 12 Jan 2025 20:18:17 +0900
Finished: Sun, 12 Jan 2025 20:18:18 +0900
Ready: True
Restart Count: 0
Environment Variables from:
kubernetes-services-endpoint ConfigMap Optional: true
Environment:
CNI_CONF_NAME: 10-calico.conflist
CNI_NETWORK_CONFIG: Optional: false
KUBERNETES_NODE_NAME: (v1:spec.nodeName)
CNI_MTU: Optional: false
SLEEP: false
Mounts:
/host/etc/cni/net.d from cni-net-dir (rw)
/host/opt/cni/bin from cni-bin-dir (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-qkrds (ro)
mount-bpffs:
Container ID: containerd://4edbe3b366ba398bfad0e7febf519a0fb66b77a26b5fa6f3d004fa43b02b3fcc
Image: docker.io/calico/node:v3.26.0
Image ID: docker.io/calico/node@sha256:5086f1ef0287886811fea4d545a4bbb75d9345367b1b1ad1aa4447af2ecbc4ea
Port:
Host Port:
Command:
calico-node
-init
-best-effort
State: Waiting
Reason: CrashLoopBackOff
Last State: Terminated
Reason: Error
Exit Code: 1
Started: Sun, 12 Jan 2025 20:19:52 +0900
Finished: Sun, 12 Jan 2025 20:19:52 +0900
Ready: False
Restart Count: 4
Environment:
Mounts:
/nodeproc from nodeproc (ro)
/sys/fs from sys-fs (rw)
/var/run/calico from var-run-calico (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-qkrds (ro)
Containers:
calico-node:
Container ID:
Image: docker.io/calico/node:v3.26.0
Image ID:
Port:
Host Port:
State: Waiting
Reason: PodInitializing
Ready: False
Restart Count: 0
Requests:
cpu: 250m
Liveness: exec [/bin/calico-node -felix-live -bird-live] delay=10s timeout=10s period=10s #success=1 #failure=6
Readiness: exec [/bin/calico-node -felix-ready -bird-ready] delay=0s timeout=10s period=10s #success=1 #failure=3
Environment Variables from:
kubernetes-services-endpoint ConfigMap Optional: true
Environment:
DATASTORE_TYPE: kubernetes
WAIT_FOR_DATASTORE: true
NODENAME: (v1:spec.nodeName)
CALICO_NETWORKING_BACKEND: Optional: false
CLUSTER_TYPE: k8s,bgp
IP: autodetect
CALICO_IPV4POOL_IPIP: Always
CALICO_IPV4POOL_VXLAN: Never
CALICO_IPV6POOL_VXLAN: Never
FELIX_IPINIPMTU: Optional: false
FELIX_VXLANMTU: Optional: false
FELIX_WIREGUARDMTU: Optional: false
CALICO_IPV4POOL_CIDR: 172.16.0.0/16
CALICO_DISABLE_FILE_LOGGING: true
FELIX_DEFAULTENDPOINTTOHOSTACTION: ACCEPT
FELIX_IPV6SUPPORT: false
FELIX_HEALTHENABLED: true
Mounts:
/host/etc/cni/net.d from cni-net-dir (rw)
/lib/modules from lib-modules (ro)
/run/xtables.lock from xtables-lock (rw)
/sys/fs/bpf from bpffs (rw)
/var/lib/calico from var-lib-calico (rw)
/var/log/calico/cni from cni-log-dir (ro)
/var/run/calico from var-run-calico (rw)
/var/run/nodeagent from policysync (rw)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-qkrds (ro)
Conditions:
Type Status
PodReadyToStartContainers True
Initialized False
Ready False
ContainersReady False
PodScheduled True
Volumes:
lib-modules:
Type: HostPath (bare host directory volume)
Path: /lib/modules
HostPathType:
var-run-calico:
Type: HostPath (bare host directory volume)
Path: /var/run/calico
HostPathType:
var-lib-calico:
Type: HostPath (bare host directory volume)
Path: /var/lib/calico
HostPathType:
xtables-lock:
Type: HostPath (bare host directory volume)
Path: /run/xtables.lock
HostPathType: FileOrCreate
sys-fs:
Type: HostPath (bare host directory volume)
Path: /sys/fs/
HostPathType: DirectoryOrCreate
bpffs:
Type: HostPath (bare host directory volume)
Path: /sys/fs/bpf
HostPathType: Directory
nodeproc:
Type: HostPath (bare host directory volume)
Path: /proc
HostPathType:
cni-bin-dir:
Type: HostPath (bare host directory volume)
Path: /opt/cni/bin
HostPathType:
cni-net-dir:
Type: HostPath (bare host directory volume)
Path: /etc/cni/net.d
HostPathType:
cni-log-dir:
Type: HostPath (bare host directory volume)
Path: /var/log/calico/cni
HostPathType:
host-local-net-dir:
Type: HostPath (bare host directory volume)
Path: /var/lib/cni/networks
HostPathType:
policysync:
Type: HostPath (bare host directory volume)
Path: /var/run/nodeagent
HostPathType: DirectoryOrCreate
kube-api-access-qkrds:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: Burstable
Node-Selectors: kubernetes.io/os=linux
Tolerations: :NoSchedule op=Exists
:NoExecute op=Exists
CriticalAddonsOnly op=Exists
node.kubernetes.io/disk-pressure:NoSchedule op=Exists
node.kubernetes.io/memory-pressure:NoSchedule op=Exists
node.kubernetes.io/network-unavailable:NoSchedule op=Exists
node.kubernetes.io/not-ready:NoExecute op=Exists
node.kubernetes.io/pid-pressure:NoSchedule op=Exists
node.kubernetes.io/unreachable:NoExecute op=Exists
node.kubernetes.io/unschedulable:NoSchedule op=Exists
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 2m28s default-scheduler Successfully assigned kube-system/calico-node-jhf5x to w1-k8s
Normal Pulled 2m27s kubelet Container image "docker.io/calico/cni:v3.26.0" already present on machine
Normal Created 2m27s kubelet Created container upgrade-ipam
Normal Started 2m27s kubelet Started container upgrade-ipam
Normal Pulled 2m27s kubelet Container image "docker.io/calico/cni:v3.26.0" already present on machine
Normal Created 2m27s kubelet Created container install-cni
Normal Started 2m26s kubelet Started container install-cni
Normal Pulled 100s (x4 over 2m25s) kubelet Container image "docker.io/calico/node:v3.26.0" already present on machine
Normal Created 100s (x4 over 2m25s) kubelet Created container mount-bpffs
Normal Started 100s (x4 over 2m24s) kubelet Started container mount-bpffs
Warning BackOff 63s (x7 over 2m23s) kubelet Back-off restarting failed container mount-bpffs in pod calico-node-jhf5x_kube-system(95d97ac1-a9cd-42
79-868f-71e02e7a697b)
다시 시작해도 1개만 이라면....
docker rate limit에 걸리지 않으셨을까 추정되는데요...
https://docs.docker.com/docker-hub/download-rate-limit/
테스트는 다음의 내용으로 가능하시고, 이게 맞다면 내일 실습하시면 될 겁니다.
우선 이걸 보고 해보시겠어요? 따라하신 후에 remaining
이 1이상 있어야 합니다.
To get a token anonymously, if you are pulling anonymously:
$ TOKEN=$(curl "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
To get a token with a user account, if you are authenticated (insert your username and password in the following command):
$ TOKEN=$(curl --user 'username:password' "https://auth.docker.io/token?service=registry.docker.io&scope=repository:ratelimitpreview/test:pull" | jq -r .token)
Then to get the headers showing your limits, run the following:
$ curl --head -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/ratelimitpreview/test/manifests/latest
Which should return the following headers:
ratelimit-limit: 100;w=21600
ratelimit-remaining: 76;w=21600
docker-ratelimit-source: 192.0.2.1
0
안녕하세요, 인프런 AI 인턴입니다. jungsu80.kim님께서 겪고 계신 문제에 대해 도움을 드리겠습니다.
Pod가 ContainerCreating
상태에서 멈춰있는 경우는 주로 네트워크 설정이나 네트워크 플러그인(CNI) 관련 문제일 가능성이 큽니다. 일반적인 발생 원인을 중심으로 해결 방법을 몇 가지 제안드리겠습니다.
네트워크 플러그인 확인: 쿠버네티스 클러스터에 설치된 Calico와 같은 네트워크 플러그인의 설치 상태를 확인해 보세요. 설치가 제대로 되지 않았거나 필수 구성 요소가 누락된 경우 위와 같은 에러가 발생할 수 있습니다.
인증 정보 확인: Pod 생성 실패 메시지에서 “connection is unauthorized: Unauthorized”라는 문구는 클러스터의 인증 정보에 문제가 있을 수 있음을 나타냅니다. kubeconfig 파일 또는 인증서 설정이 올바른지 확인해 보세요.
노드 상태 점검: 명령어 kubectl get nodes
를 사용하여 노드가 모두 Ready 상태인지 확인해 보세요. 노드가 NotReady 상태라면 해당 노드의 로그를 통해 원인을 확인해야 합니다.
클러스터 재시작: 클러스터 관리를 위한 VM이나 시스템을 재시작하는 것이 도움이 될 때도 있습니다. 가끔 VM 네트워크 인터페이스나 설정이 불안정할 수 있기 때문입니다.
관련해서 참고할 만한 기존 질문과 답변 링크를 제공해 드립니다:
- nginx 파드 명령어 수행 후에, pods 상태가 ImagePullBackoff 입니다 - 일반적인 초기 Pod 생성 문제에 대한 설명을 담고 있습니다.
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다. 현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏 추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.
알려주신 작업 실행하니 정상적으로 실행됩니다. 감사합니다.