我一直在跟进本教程,并且能够在 aws 环境中创建 K8S 集群,直到这一步https://github.com/prabhatsharma/kubernetes-the-hard-way-aws/blob/master/docs/13 -smoke-test.md。一切正常,但工作负载不受信任。不受信任的工作负载容器挂起在其挂起状态。
$ k get pods -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
untrusted 0/1 Pending 0 3m38s 10.200.1.7 ip-10-0-1-21 <none> <none>
似乎 runsc (gVisor) 未完全配置为不受信任的工作负载运行时。虽然 toml 文件包含这个推荐的配置:
ubuntu@ip-10-0-1-21:~$ cat /etc/containerd/config.toml
[plugins]
[plugins.cri.containerd]
snapshotter = "overlayfs"
[plugins.cri.containerd.default_runtime]
runtime_type = "io.containerd.runtime.v1.linux"
runtime_engine = "/usr/local/bin/runc"
runtime_root = ""
[plugins.cri.containerd.untrusted_workload_runtime]
runtime_type = "io.containerd.runtime.v1.linux"
runtime_engine = "/usr/local/bin/runsc"
runtime_root = "/run/containerd/runsc"
我可以通过启动以下命令来查看正在运行的容器:
ubuntu@ip-10-0-1-21:~$ sudo runsc --root /run/containerd/runsc/k8s.io list
ID PID STATUS BUNDLE CREATED OWNER
810812c901c432ef406bebe4730a925a73976e0f057a724cfd84ef8e5d9cefc4 1077 running /run/containerd/io.containerd.runtime.v1.linux/k8s.io/810812c901c432ef406bebe4730a925a73976e0f057a724cfd84ef8e5d9cefc4 2021-04-18T15:35:46.15756454Z
e1241cc457631f60ab8560317235fbe97bf8b0a89b86336c8dd59d5dc0a27654 1077 running /run/containerd/io.containerd.runtime.v1.linux/k8s.io/e1241cc457631f60ab8560317235fbe97bf8b0a89b86336c8dd59d5dc0a27654 2021-04-18T15:35:48.208150407Z
ubuntu@ip-10-0-1-21:~$ sudo ctr -n k8s.io containers list
CONTAINER IMAGE RUNTIME
810812c901c432ef406bebe4730a925a73976e0f057a724cfd84ef8e5d9cefc4 sha256:da86e6ba6ca197bf6bc5e9d900febd906b133eaa4750e6bed647b0fbe50ed43e io.containerd.runtime.v1.linux
e1241cc457631f60ab8560317235fbe97bf8b0a89b86336c8dd59d5dc0a27654 sha256:f4dc9e2ce94362f78a358cbf0ffc71ffe2fc11224c94857f21a1f7e1df5997ef io.containerd.runtime.v1.linux