How Do I Fix the Docker Baseline in a Cluster Environment?
In a managed cluster such as Kubernetes, Swarm, or CCE, the Docker daemon parameters and container runtime are centrally managed by the cluster control plane.
Applying baseline suggestions directly to a node can cause the following issues:
- Configuration rollback: When a node is re-enrolled or a container is rebuilt, the orchestration system automatically rolls back manual changes on specifications.
- Cluster exception: After the dockerd startup parameters are modified, a node becomes unreachable or a pod cannot be scheduled.
- No modification entry: Containers managed by workloads (Deployment, StatefulSet, DaemonSet) cannot be configured directly on individual nodes.
Therefore, Docker baseline remediation must be approached at two distinct levels: node-level remediation and cluster/workload-level remediation.
How Do I Determine Whether the Environment Is a Cluster Environment?
Before fixing the Docker baseline, check whether the target host belongs to a managed cluster. If any of the following conditions are met, the host is in a managed cluster environment.
| No. | Procedure |
|---|---|
| 1 | Check the cluster component processes. ps -ef | grep -E 'kubelet|kube-proxy|docker-swarm|containerd' | grep -v grep |
| 2 | Check the cluster configuration file. ls /etc/kubernetes/ 2>/dev/null systemctl status kubelet 2>/dev/null |
| 3 | Check the container orchestration indicator. docker info 2>/dev/null | grep -iE 'swarm|cluster' If an orchestration indicator exists, the current environment is a managed cluster environment. |
| 4 | Check the environment variable CLUSTER_ID. env | grep CLUSTER_ID If the CLUSTER_ID environment variable exists, the current environment is a managed cluster environment. |
| 5 | Check nodes under cloud platform management. If the agent process exists on a CCE or cloud-managed node, or node labels or annotations contain cluster identifiers, the current environment is a managed cluster environment. |
Remediation Suggestions for Common Scenarios
Based on the following scenarios, determine whether a baseline finding should be remediated at the node level or at the cluster/workload level.
| Scenario | Risk Level | Suggestion |
|---|---|---|
| File permission/ownership | Low | Remediation can be directly performed on nodes. Common items are as follows:
|
| Host partition | High | Create a separate partition for the container, for example, mount /var/lib/docker to an independent partition (LVM). You need to stop the Docker service, migrate data, and modify the mount configuration in /etc/fstab. You are advised to apply for a downtime window in advance and manually perform the operations. Automatic online fixing is not recommended. |
| dockerd startup parameters | High | dockerd startup parameters affect the entire daemon process. In managed cluster environments, modifying these parameters directly on individual nodes is prohibited. |
| Running container configuration | High | You are advised to fix it at the cluster or workload level.
|
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot