gpt4 book ai didi

docker - 无法将 shell 放入 kubernetes 中的 citadel 容器中

转载 作者:行者123 更新时间:2023-12-02 09:55:20 28 4
gpt4 key购买 nike

我使用 https://istio.io/docs/setup/kubernetes/helm-install 中的说明在 minikube 中运行 Istio(包括 citadel) .

$ helm template install/kubernetes/helm/istio --name istio --namespace istio-system > $HOME/istio.yaml
$ kubectl create namespace istio-system
$ kubectl apply -f $HOME/istio.yaml

当我尝试将 shell 放入 citadel 容器时,出现错误:

$ kubectl exec -it istio-citadel-6d7f9c545b-bkvnx  -- /bin/bash
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown
command terminated with exit code 126

但是,我可以执行其他容器,例如 Pilot Fine。

这些是我的 Pod 和容器,如果有帮助的话。

shell-demo:                             nginx,
istio-citadel-6d7f9c545b-bkvnx: docker.io/istio/citadel:1.0.3,
istio-cleanup-secrets-rp4wv: quay.io/coreos/hyperkube:v1.7.6_coreos.0,
istio-egressgateway-866885bb49-6jz9q: docker.io/istio/proxyv2:1.0.3,
istio-galley-6d74549bb9-7nhcl: docker.io/istio/galley:1.0.3,
istio-ingressgateway-6c6ffb7dc8-bvp6b: docker.io/istio/proxyv2:1.0.3,
istio-pilot-685fc95d96-fphc9: docker.io/istio/pilot:1.0.3, docker.io/istio/proxyv2:1.0.3,
istio-policy-688f99c9c4-bpl9w: docker.io/istio/mixer:1.0.3, docker.io/istio/proxyv2:1.0.3,
istio-security-post-install-s6dft: quay.io/coreos/hyperkube:v1.7.6_coreos.0,
istio-sidecar-injector-74855c54b9-6v5xg:docker.io/istio/sidecar_injector:1.0.3,
istio-telemetry-69b794ff59-f7dv4: docker.io/istio/mixer:1.0.3, docker.io/istio/proxyv2:1.0.3,
prometheus-f556886b8-lhdt8: docker.io/prom/prometheus:v2.3.1,
coredns-c4cffd6dc-6xblf: k8s.gcr.io/coredns:1.2.2,
etcd-minikube: k8s.gcr.io/etcd-amd64:3.1.12,
kube-addon-manager-minikube: k8s.gcr.io/kube-addon-manager:v8.6,
kube-apiserver-minikube: k8s.gcr.io/kube-apiserver-amd64:v1.10.0,
kube-controller-manager-minikube: k8s.gcr.io/kube-controller-manager-amd64:v1.10.0,
kube-dns-86f4d74b45-bjk54: k8s.gcr.io/k8s-dns-kube-dns-amd64:1.14.8, k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64:1.14.8, k8s.gcr.io/k8s-dns-sidecar-amd64:1.14.8,
kube-proxy-mqfb9: k8s.gcr.io/kube-proxy-amd64:v1.10.0,
kube-scheduler-minikube: k8s.gcr.io/kube-scheduler-amd64:v1.10.0,
kubernetes-dashboard-6f4cfc5d87-zwk2c: k8s.gcr.io/kubernetes-dashboard-amd64:v1.10.0,
storage-provisioner: gcr.io/k8s-minikube/storage-provisioner:v1.8.1,

当我执行 minikube ssh 然后尝试执行到 citadel 容器时,我收到类似的错误:

$ docker ps | grep citadel
f173453f843c istio/citadel "/usr/local/bin/isti…" 3 hours ago Up 3 hours k8s_citadel_istio-citadel-6d7f9c545b-bkvnx_istio-system_3d7b4f08-e120-11e8-bc40-ee7dbbb8f91b_0
7e96617d81ff k8s.gcr.io/pause-amd64:3.1 "/pause" 3 hours ago Up 3 hours k8s_POD_istio-citadel-6d7f9c545b-bkvnx_istio-system_3d7b4f08-e120-11e8-bc40-ee7dbbb8f91b_0

$ docker exec -it f173453f843c sh
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"sh\": executable file not found in $PATH": unknown

$ docker exec -it f173453f843c /bin/sh
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknown

$ docker exec -it f173453f843c ls
OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "exec: \"ls\": executable file not found in $PATH": unknown

我可以很好地看到城堡容器日志。日志可在 https://pastebin.com/xTy9vSz2 获取。

你知道为什么我们不能执行到 citadel 容器吗?

感谢您的阅读。

最佳答案

您无法使用 shell,因为容器中的 shbash 都不可用。很多时候,为了提高效率和拥有最小的容器镜像,这些都会被删除。

如果您想进入容器,我建议您在其中包含 bashsh 来构建自己的镜像。

您可以在此处看到 Dockerfile构建一个只有静态二进制文件的镜像。为此,您需要更改基本镜像。例如:

FROM alpine

而不是:

FROM scratch

希望有帮助。

关于docker - 无法将 shell 放入 kubernetes 中的 citadel 容器中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53161299/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com