Manage Node Isolation Policies with the CLI
Node isolation policies provide project-level node isolation. Platform administrators can bind one or more projects to selected cluster nodes and choose whether those nodes are exclusive to the bound projects or shared with other projects.
In versions where the web console no longer provides Administrator > Security Settings > Node Isolation Policies, you can continue to manage node isolation policies with ac or kubectl.
TOC
How Node Isolation Policies WorkBefore You BeginAuthenticate to ACPView Node Isolation PoliciesCheck Available Projects and NodesCreate a Node Isolation PolicyUpdate a Node Isolation PolicyUpdate Display NameChange Share ModeReplace Bound ProjectsReplace Bound NodesDelete a Node Isolation PolicyVerify Scheduling BehaviorVerify LabelsVerify New Pod SchedulingTroubleshootingRecommended Operation FlowHow Node Isolation Policies Work
A node isolation policy is stored as a Kubernetes custom resource named NodeGroup.
The key fields are:
The sharing modes are:
Exclusive: Only projects bound to the policy can schedule new Pods on the policy nodes. Other projects cannot schedule new Pods on those nodes.Share: Projects bound to the policy are constrained to the policy nodes, but other projects can still use those nodes.
After a policy is created or updated, the platform labels related Node and Namespace resources, labels ProjectQuota objects when they exist, and injects scheduling constraints when Pods are created or updated. Common labels and taints include:
Before You Begin
Before you run the commands in this guide, confirm the following:
- The
acCLI is installed. If you usekubectl, prepare a kubeconfig for the target cluster first. - Your account can manage
nodegroups.security.alauda.io. - You know the target workload cluster name, for example
business-1. - You know the project names and node names to bind.
- You have evaluated the impact on existing workloads.
Important limits:
NodeGroupis a cluster-scoped resource. Do not specify-nwhen managingNodeGroupresources.- In one workload cluster, each project can belong to only one node isolation policy.
- In one workload cluster, each node can belong to only one node isolation policy.
- Creating a policy does not move existing Pods. Existing Pods that do not match the policy are constrained only after they are recreated.
- In
Exclusivemode, existing Pods on the policy nodes are not evicted automatically. Migrate them manually if required. - The web console creation page filters out control plane nodes and disables projects and nodes that are already used by another policy. When you use the CLI, check conflicts yourself before creating or updating a policy.
Authenticate to ACP
Use ac to manage node isolation policies. The ac CLI manages ACP multi-cluster sessions and can switch to the target workload cluster.
Example:
Confirm that the NodeGroup CRD exists:
If you prefer kubectl, export kubeconfig from ac and then select the target context. Use the value from the NAME column in kubectl config get-contexts as <target-context>.
The following examples use ac. If your kubectl context is configured correctly, you can replace ac with kubectl.
View Node Isolation Policies
View all node isolation policies in the current cluster:
View the policy list with selected fields:
View details for one policy:
Check whether the policy is reconciled:
When status.phase is Active, the controller has reconciled the policy.
Check Available Projects and Nodes
Before you create or update a policy, check whether the projects and nodes are already used by another policy.
If ProjectQuota objects exist in the environment, view their node isolation labels:
View ProjectQuota objects that are not bound to a policy:
View nodes and their node isolation labels:
View compute nodes that are not bound to a policy:
Create a Node Isolation Policy
Create nodegroup-pro.yaml:
Set spec.shareMode to Exclusive when the bound projects must have exclusive access to the nodes. Set it to Share when the bound projects must run on the selected nodes but other projects can still use those nodes.
Apply the policy:
Confirm the policy status:
Confirm that the nodes are labeled:
For Exclusive policies, confirm that a policy node has the nodeGroup taint:
In the output, check that Taints contains:
Shared nodes usually do not keep a nodeGroup=<policy-name>:NoSchedule taint.
Update a Node Isolation Policy
Before you update a policy, check its current configuration:
Update Display Name
Change Share Mode
Switch the policy to shared mode:
Switch the policy to exclusive mode:
After the policy switches to Exclusive, the controller adds nodeGroup=<policy-name>:NoSchedule to the policy nodes. Existing Pods are not evicted by this taint, but new Pods are constrained.
Replace Bound Projects
The following command replaces the entire project list with pro and dev:
Replace Bound Nodes
The following command replaces the entire node list with node-1 and node-2:
Important:
spec.projectsandspec.nodesare arrays. A merge patch replaces the entire array. Include the complete final list in the patch to avoid removing projects or nodes unintentionally.
Delete a Node Isolation Policy
After you delete a policy, the bound projects are no longer restricted to the policy nodes, and the nodes are no longer reserved for the policy.
Confirm that the policy is deleted:
Confirm that related labels are cleaned up:
If the policy stays in deletion for a long time, do not remove its finalizer directly. Check the node isolation controller and webhook first.
Verify Scheduling Behavior
After you create or update a policy, verify that it is effective.
Verify Labels
View policy nodes:
View policy project quotas, if ProjectQuota objects exist in the environment:
View namespaces that belong to the policy projects:
Verify New Pod Scheduling
Create a test Pod in a namespace that belongs to a bound project:
View the node where the Pod is scheduled:
View the injected node selector and toleration:
In the output, check for the following fields:
Delete the test Pod after verification:
Note:
Existing Pods go through the scheduling flow again only after they are recreated.
Troubleshooting
Recommended Operation Flow
For production operations, use the following flow:
- Confirm the target workload cluster context.
- Query the existing
NodeGrouplist. - Check whether the projects and nodes are already bound to another policy.
- Write and save the
NodeGroupYAML. - Create or update the policy with
ac apply -f. - Wait until
status.phaseisActive. - Check the
Node,Namespace, andProjectQuotalabels when the related resources exist. - Create a new test Pod in a test namespace to verify scheduling.
- Recreate business workloads or migrate existing Pods only after verification.