calico-kube-controllers open /status/status.json: permission denied

在k8s单节点集群环境中,由于目录权限问题导致calico-kube-controllerspod容器未就绪。错误日志显示无法写入status.json状态。通过编辑部署配置,添加volume挂载并修改属组权限,成功解决了容器的就绪问题。
摘要由CSDN通过智能技术生成

calico-kube-controllers pod容器未就绪

####### 在一台机器上装k8s单节点集群,因/目录空间较小,便将docker和kubelet的存储目录迁移至新盘挂载目录。将数据拷贝时没注意目录权限问题,导致重启docker和kubelet后 ,calico容器未就绪,查看日志提示没有权限写入就绪状态到/sttaus/status.json文件。 因为进入pod命令行提示无bash ,sh,故通过修改calico-kube-controllers deployments,增加volume挂载到本地,赋权修改属组后容器就绪正常

  报错日志
  Warning  FailedCreatePodSandBox  82s                kubelet            Failed to create pod sandbox: rpc error: code = Unknown desc = failed to set up sandbox container "8e4802781f47bdb99ddef852e0220d830d429d0277f1d17f8b569621743a5aaa" network for pod "calico-kube-controllers-56c7cdffc6-mqcjr": networkPlugin cni failed to set up pod "calico-kube-controllers-56c7cdffc6-mqcjr_kube-system" network: stat /var/lib/calico/nodename: no such file or directory: check that the calico/node container is running and has mounted /var/lib/calico/
  Normal   Pulled                  81s                kubelet            Container image "docker.io/calico/kube-controllers:v3.18.6" already present on machine
  Normal   Created                 81s                kubelet            Created container calico-kube-controllers
  Normal   Started                 81s                kubelet            Started container calico-kube-controllers
  Warning  Unhealthy               2s (x8 over 72s)   kubelet            Readiness probe failed: Failed to read status file /status/status.json: unexpected end of JSON 
编辑deployments/calico-kube-controllers
kubectl edit deployments/calico-kube-controllers -n kube-system
添加如下
    volumeMounts:
    - mountPath: /status
      name: status
volumes:
- hostPath:
    path: /var/run/calico/status
    type: ""
  name: status
到宿主机目录查看/var/run/calico/status
发现status.json文件是polkitd:root 用户属组,修改/var/run/calico/status目录属组用户为polkitd:root后,容器正常
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值