为何 oc debug 命令使用 container is unable to start error 失败?

在私有群集上运行 oc debug 命令时,会出现与下例类似的错误信息。

oc debug node/<node-name>
Starting pod/1024104-debug ...
To use host binaries, run `chroot /host`

warning: Container container-00 is unable to start due to an error: Back-off pulling image "quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:7dd7a3a1be7009629c709e6c88a1551d471aba9bf3deb873bc5f4d814675edfe"

oc debug 命令在您指定的节点上启动调试 pod。 调试 pod 使用 quay.io 容器注册表中的公共容器映像。 在无法访问公共因特网的专用集群上,集群无法从公共注册表中拉取调试容器映像。

要解决此问题,请从 quay.io 中拉取 ocp-release 映像并将其推送到专用映像注册表。 然后,在运行 oc debug 命令时,指定要使用的专用容器映像。

  1. quay.io 中拉取与集群版本和体系结构相匹配的映像。 例如,如果您有 4.7.19 集群,请拉取 quay.io/openshift-release-dev/ocp-release:4.7.19-x86_64 映像。 请注意,您必须具有 Red Hat 帐户和许可权才能拉取映像。

    docker pull quay.io/openshift-release-dev/ocp-release:4.7.19-x86_64
    
  2. 标记映像并将其推送到专用容器注册表

  3. 使用 --image=icr.io 选项重试 oc debug 命令。

    oc debug node/<node-name> --image=icr.io/<namespace>/<image>:<tag>