DevOps/k8s

Kubectl run 시 image tag 지정

xlwdn98767 2023. 6. 10. 00:42
728x90

Kubectl run 시 image tag 지정

 kubectl run nginx --image=nginx:latest

k8s의 container manager를 crio로 설정하고 위 명령어를 실행시키면

 [user@ubuntu01 ~ (kubernetes-admin@cluster.local:default)]$ k describe pod nginx
Name:         nginx
Namespace:    default
Priority:     0
Node:         ubuntu01/172.16.132.130
Start Time:   Thu, 29 Dec 2022 00:41:33 +0900
Labels:       run=nginx
Annotations:  cni.projectcalico.org/containerID: 1f8d14e6af5bf403c348372908b98d3b694094de85321da9c370d809f1219180
              cni.projectcalico.org/podIP: 10.233.67.207/32
              cni.projectcalico.org/podIPs: 10.233.67.207/32
Status:       Pending
IP:           10.233.67.207
IPs:
  IP:  10.233.67.207
Containers:
  nginx:
    Container ID:
    Image:          nginx
    Image ID:
    Port:           <none>
    Host Port:      <none>
    State:          Waiting
      Reason:       ImageInspectError
    Ready:          False
    Restart Count:  0
    Environment:    <none>
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-6ncfh (ro)
Conditions:
  Type              Status
  Initialized       True
  Ready             False
  ContainersReady   False
  PodScheduled      True
Volumes:
  kube-api-access-6ncfh:
    Type:                    Projected (a volume that contains injected data from multiple sources)
    TokenExpirationSeconds:  3607
    ConfigMapName:           kube-root-ca.crt
    ConfigMapOptional:       <nil>
    DownwardAPI:             true
QoS Class:                   BestEffort
Node-Selectors:              <none>
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      19s               default-scheduler  Successfully assigned default/nginx to ubuntu01
  Warning  InspectFailed  5s (x4 over 19s)  kubelet            Failed to inspect image "nginx": rpc error: code = Unknown desc = short-name "nginx:latest" did not resolve to an alias and no unqualified-search registries are defined in "/etc/containers/registries.conf.d/01-unqualified.conf"
  Warning  Failed         5s (x4 over 19s)  kubelet            Error: ImageInspectError

위와 같이 Waiting 상태로 파드가 실행되지 않는다.

해결 방법

 kubectl run nginx --image=docker.io/nginx:latest

이유는 태그의 모호성 제거 때문이라네요.

https://unix.stackexchange.com/questions/701784/podman-no-longer-searches-dockerhub-error-short-name-did-not-resolve-to-an