Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This article shows you how to switch SELinux (Security-Enhanced Linux) from enforcing mode to permissive mode on Azure Container Linux (ACL) nodes in Azure Kubernetes Service (AKS) for troubleshooting purposes. This can be useful when you need to collect diagnostics or validate workload behavior that is being blocked by SELinux enforcement on ACL nodes.
Symptom
You need to collect diagnostics or validate workload behavior, but SELinux enforcement blocks the action on ACL nodes.
Cause
ACL nodes run SELinux in enforcing mode by default. To change behavior, you must apply the ACL security profile tag on the node pool.
Prerequisites
- Azure CLI installed and signed in.
- You know your AKS cluster name, resource group, and node pool name.
- You can access a node for verification. For details, see Connect to AKS nodes with kubectl debug.
Resolution
To switch SELinux from enforcing mode to permissive mode on ACL nodes, you can either create a new ACL node pool or update an existing ACL node pool with the appropriate tag. The tag to set is acl-node-security-profile=selinux=permissive.
Option 1: Create a new ACL node pool in permissive mode
Create a new ACL node pool in permissive mode using the
az aks nodepool addcommand with the--tagsparameter to set the ACL security profile tag.az aks nodepool add \ --resource-group <resource-group-name> \ --cluster-name <cluster-name> \ --name <node-pool-name> \ --node-count 1 \ --tags acl-node-security-profile="selinux=permissive" \ --no-waitVerify the tag was applied using the
az aks showcommand to check the node pool profiles and their tags.az aks show \ --resource-group <resource-group-name> \ --name <cluster-name> \ --query "agentPoolProfiles[].{nodepoolName:name,tags:tags}"Example output:
[ { "nodepoolName": "<node-pool-name>", "tags": { "acl-node-security-profile": "selinux=permissive" } } ]
Option 2: Update an existing ACL node pool
Update an existing ACL node pool to permissive mode using the
az aks nodepool updatecommand with the--tagsparameter to set the ACL security profile tag.az aks nodepool update \ --resource-group <resource-group-name> \ --cluster-name <cluster-name> \ --name <node-pool-name> \ --tags acl-node-security-profile="selinux=permissive" \ --no-waitVerify the tag was applied using the
az aks showcommand to check the node pool profiles and their tags.az aks show \ --resource-group <resource-group-name> \ --name <cluster-name> \ --query "agentPoolProfiles[].{nodepoolName:name,tags:tags}"Example output:
[ { "nodepoolName": "<node-pool-name>", "tags": { "acl-node-security-profile": "selinux=permissive" } } ]Restart the nodes in the node pool so the new SELinux mode takes effect.
Verification
Connect to a node in the target pool using
kubectl debugand chroot into the host filesystem.Run the
sestatuscommand to check the current SELinux mode:sestatusIn the output, confirm
Current modeshowspermissive. For example:SELinux status: enabled SELinuxfs mount: /sys/fs/selinux SELinux root directory: /etc/selinux Loaded policy name: targeted Current mode: permissive Mode from config file: permissive Policy MLS status: enabled Policy deny_unknown status: allowed Memory protection checking: actual (secure) Max kernel policy version: 33