2

I created a microk8s cluster, pods could be listed by get pod command:

ubuntu@ip-172-31-16-34:~$ microk8s.kubectl get pod --all-namespaces
NAMESPACE       NAME                                         READY   STATUS    RESTARTS   AGE
kube-system     coredns-f7867546d-mlsbm                      1/1     Running   1          98m
kube-system     hostpath-provisioner-65cfd8595b-l2hjz        1/1     Running   1          98m
kube-system     tiller-deploy-758bcdc94f-cwbjd               1/1     Running   0          93m
seldon-system   seldon-controller-manager-54955d8675-72qxn   1/1     Running   0          33m

However, I tried to list containers with ctr, nothing showing

ubuntu@ip-172-31-16-34:~$ microk8s.ctr c ls
CONTAINER    IMAGE    RUNTIME

also try image list

$ microk8s.ctr image list
REF TYPE DIGEST SIZE PLATFORMS LABELS

nothing :P maybe I need to find which namespace it used ?

4

1 回答 1

5

microk8s.ctr我从问题https://github.com/ubuntu/microk8s/issues/756中找到了正确的命名空间

添加后它可以工作-n k8s.io

ubuntu@ip-172-31-16-34:~$ microk8s.ctr -n k8s.io c ls | head
CONTAINER                                                           IMAGE                                                                      RUNTIME
040bd2dcc65ecbd5cd6fc6621ed8059864d0b9f33ac1a5bac129ba3da9d45993    k8s.gcr.io/pause:3.1                                                       io.containerd.runtime.v1.linux
04b368611ede93ad9bcc90c1cca2e0285697a85e51afb7a8acd60e73ee27dc2a    k8s.gcr.io/pause:3.1                                                       io.containerd.runtime.v1.linux
050b0a44da4f89b34a4d415c0b584dc6c01fad3ba4ad5676e291113efe889099    k8s.gcr.io/pause:3.1                                                       io.containerd.runtime.v1.linux
0e807caf6967f11eff003fb4dd756b1c9665b3c72297903189b3478fe7b46bc1    k8s.gcr.io/pause:3.1                                                       io.containerd.runtime.v1.linux
144f38f7bd30bdff65a79fd627f52545612cc8669e5851ca4e6d80b99004b546    k8s.gcr.io/pause:3.1                                                       io.containerd.runtime.v1.linux
164bc117c9b128632be3466ce50408be5bf32e68bcc3fd6e062d7f1ec2ab89f6    k8s.gcr.io/pause:3.1                                                       io.containerd.runtime.v1.linux
16fae375f02bc617dd99f102f0230954ec71a4850c3428b86215b05977679a24    k8s.gcr.io/pause:3.1                                                       io.containerd.runtime.v1.linux
18389fce9a2c4bd4fab9a0e2d905592a9df8b73a7bdf1e42a314b7e7e557187e    docker.io/jupyterhub/configurable-http-proxy:4.1.0                         io.containerd.runtime.v1.linux
1e56ccf5a49df5b3acda2ca0634bc8661da91476c0a611deeb96cd2190b66985    docker.io/metacontroller/jsonnetd:0.1                                      io.containerd.runtime.v1.linux
于 2020-04-08T03:34:18.547 回答