美文网首页
Kubernetes(k8s)临时容器EphemeralCont

Kubernetes(k8s)临时容器EphemeralCont

作者: 祁恩达 | 来源:发表于2021-08-07 00:42 被阅读0次

    临时容器的作用:

    当由于容器崩溃或容器镜像不包含调试工具而导致 kubectl exec 无用时, 临时容器对于交互式故障排查很有用。

    开启临时容器

    vi /usr/lib/systemd/system/kube-apiserver.service
    --feature-gates=EphemeralContainers=true
    
    vi /usr/lib/systemd/system/kube-controller-manager.service
    --feature-gates=EphemeralContainers=true
    
    vi /usr/lib/systemd/system/kube-scheduler.service
    --feature-gates=EphemeralContainers=true
    vi /usr/lib/systemd/system/kube-proxy.service
    --feature-gates=EphemeralContainers=true
    
    vi /etc/kubernetes/kubelet-conf.yml
    featureGates:
      EphemeralContainers: true
    
    重启所有服务
    

    临时容器的使用

    K8s 1.16+

    https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/
    

    K8s 1.18+

    kubectl alpha debug redis-new-5b577b46c7-2jv4j -ti --image=registry.cn-beijing.aliyuncs.com/dotbalo/debug-tools
    

    K8s 1.20+

    kubectl debug redis-new-5b577b46c7-2jv4j -ti --image=registry.cn-beijing.aliyuncs.com/dotbalo/debug-tools
    kubectl debug node/k8s-node01 -it --image=registry.cn-beijing.aliyuncs.com/dotbalo/debug-tools
    

    相关文章

      网友评论

          本文标题:Kubernetes(k8s)临时容器EphemeralCont

          本文链接:https://www.haomeiwen.com/subject/airivltx.html