已关闭此问题为not about programming or software development。它目前不接受回答。
这个问题似乎不是关于a specific programming problem, a software algorithm, or software tools primarily used by programmers的。如果你认为这个问题与another Stack Exchange site的主题有关,你可以留下评论,解释在哪里可以回答这个问题。
上个月关门了。
Improve this question
我在用kind测试k8
我创建了集群:
vagrant@vagrant:~$ sudo kind get clusters
nodes-test
现在我想用sudo kind delete cluster
删除这个集群,但得到:
Deleting cluster "kind" ...
failed to update kubeconfig: failed to lock config file: open /root/.kube/config.lock: read-only file system
ERROR: failed to delete cluster "kind": failed to lock config file: open /root/.kube/config.lock: read-only file system
但是当我转到路径时,我看不到文件:
vagrant@vagrant:~$ sudo su
root@vagrant:/home/vagrant# cd /root
root@vagrant:~# cd .kube/
root@vagrant:~/.kube# ls -la
total 20
drwxr-xr-x 3 root root 4096 Sep 8 12:07 .
drwx------ 6 root root 4096 Sep 8 12:26 ..
drwxr-x--- 4 root root 4096 Sep 8 12:00 cache
-rw------- 1 root root 5622 Sep 8 11:59 config
配置文件:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ss==
server: https://127.0.0.1:44155
name: kind-nodes-test
contexts:
- context:
cluster: kind-nodes-test
user: kind-nodes-test
name: kind-nodes-test
current-context: kind-nodes-test
kind: Config
preferences: {}
users:
- name: kind-nodes-test
user:
client-certificate-data: sss
client-key-data: sdasd=
Netid State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess
udp UNCONN 0 0 127.0.0.53%lo:domain 0.0.0.0:* users:(("systemd-resolve",pid=10281,fd=13))
udp UNCONN 0 0 10.0.2.15%eth0:bootpc 0.0.0.0:* users:(("systemd-network",pid=10265,fd=18))
tcp LISTEN 0 4096 127.0.0.53%lo:domain 0.0.0.0:* users:(("systemd-resolve",pid=10281,fd=14))
tcp LISTEN 0 128 0.0.0.0:ssh 0.0.0.0:* users:(("sshd",pid=711,fd=3))
tcp LISTEN 0 4096 127.0.0.1:44155 0.0.0.0:* users:(("docker-proxy",pid=1109,fd=4))
tcp LISTEN 0 128 [::]:ssh [::]:* users:(("sshd",pid=711,fd=4))
更新
同样,当调用sudo kind delete cluster --name nodes-test
命令时,我得到:
vagrant@vagrant:~$ sudo kind delete cluster --name nodes-test
Deleting cluster "nodes-test" ...
failed to update kubeconfig: failed to lock config file: open /root/.kube/config.lock: read-only file system
ERROR: failed to delete cluster "nodes-test": failed to delete nodes: command "docker rm -f -v nodes-test-worker nodes-test-control-plane" failed with error: exit status 1
Command Output: Error response from daemon: container 4cf8b399150fffb9899ff963adacd255fe3b0b7aebdf6feda11ea1646b541340: driver "overlay2" failed to remove root filesystem: unlinkat /var/lib/docker/overlay2/1ba0d047b313dabc396f61cf1f2b3086d5cad05372de37410326d81e02f6130b: read-only file system
Error response from daemon: container 8b2fa50dc006191add9b64e89b834a0c952344433e61d1b9795b5c2470bf3e05: driver "overlay2" failed to remove root filesystem: unlinkat /var/lib/docker/overlay2/3a35de9a7ad18fbf3358c0be3d01a51ba7c7558ed49242d659a0e365c58798ae: read-only file system
1条答案
按热度按时间sd2nnvve1#
当您键入命令以获取群集时,它会列出群集的名称:
所以你的集群名是
nodes-test
。但是输入sudo kind delete cluster
只会尝试删除默认的集群名称(默认情况下命名为kind
)。这也是为什么delete命令显示为Deleting cluster "kind" ...
。您需要使用集群名称运行delete命令。您甚至可以在delete命令的文档中阅读这一点如果未指定标志
--name
,kind将使用默认的集群上下文名称kind
并删除该集群。注意:根据设计,请求删除不存在的群集不会返回错误。这是有意的,并且是具有清理资源的幂等方式的手段。
您需要指定群集名称。试试这个:
sudo kind delete cluster --name nodes-test