Home / FAQ / How do I enable Pod Debug in an access cluster?

How do I enable Pod Debug in an access cluster?

To use the Pod Debug feature in an access cluster, the following conditions must be met:

This article will use the Kubernetes Cluster as an example to show you how to enable the EphemeralContainers feature switch for the relevant components on all Controller Nodes and Compute nodes in the cluster.

Turn on the function switch of the component on the control node

To enable the EphemeralContainers feature switch for the corresponding components, modify the kube-apiserver.yaml, kube-controller-manager.yaml, and kube-scheduler.yaml configuration files on all control nodes in the cluster.

Procedure:

  1. Run the following command on the control node to enter the directory where the files are located.

    cd /etc/kubernetes/manifests/
  2. Execute the following command line and modify the container startup parameters in the kube-apiserver.yaml, kube-controller-manager.yaml, and kube-scheduler.yaml files according to the examples.

    vi <Configuration file name>    

    Tip:Multiple values are separated by ,. If the corresponding configuration item is missing in the file, please add it manually.

    example

    spec:
      containers:
      - command:
        - <Component name>    ## The component name corresponding to the configuration file. kube-apiserver, kube-controller-manager, kube-scheduler
        - --feature-gates=EphemeralContainers=true,...
  3. Execute the following command line to restart kubelet.

    systemctl restart kubelet.service

Turns on the function switch of the component on the compute node

By modifying the startup parameters of the kubelet component on All Compute Nodes in the cluster, enable the EphemeralContainers function switch.

Option 1

  1. Execute the following command on the compute node and add the environment variable --feature-gates=EphemeralContainers=true to the kubeadm-flags.env file, referring to the example.

    vi /var/lib/kubelet/kubeadm-flags.env

    For example

    KUBELET_KUBEADM_ARGS="--feature-gates=EphemeralContainers=true,CSIStorageCapacity=true --hostname-override=192.168.31.207 --network-plugin=cni --node-ip=192.168.31.207,2002::192:168:31:207 --node-labels=platform.tkestack.io/machine-ipv6-head=2002aa192a,platform.tkestack.io/machine-ipv6-tail=168a31a207 --pod-infra-container-image=192.168.31.206:60080/tkestack/pause:3.2"
  2. Execute the following command line to restart kubelet.

    systemctl restart kubelet.service

Plan 2

  1. Execute the following command on the computing node. Refer to the example in the config.yaml file and add the EphemeralContainers: true configuration item to the featureGates parameter.

    vi /var/lib/kubelet/config.yaml

    For example

    featureGates:
      IPv6DualStack: true
      EphemeralContainers: true    
  2. Execute the following command line to restart kubelet.

    systemctl restart kubelet.service