Configure Kubernetes Pod Scheduling¶
This guide describes how to configure Kubernetes pod scheduling features for Privacera services. This allows you to control where pods are scheduled, how they tolerate node taints, and how they are distributed across your Kubernetes cluster for high availability.
Overview¶
Privacera Manager supports the following Kubernetes scheduling features:
- Node Selectors: Control which nodes pods can be scheduled on based on node labels
- Tolerations: Allow pods to schedule on nodes with matching taints
- Node Affinity: Define advanced node selection rules with flexible matching
- Pod Topology Spread Constraints: Control pod distribution across zones, nodes, or other topology domains
- Pod Disruption Budgets: Ensure minimum pod availability during voluntary disruptions (e.g., node maintenance)
These features can be configured globally for all services or per-service for fine-grained control.
Prerequisites¶
Before configuring pod scheduling, ensure:
- Kubernetes cluster with labeled nodes and/or taints configured
- For cloud-specific configurations (AWS EKS with Karpenter, Azure AKS, GCP GKE), ensure node pools and labels are properly configured
- Understanding of your cluster's node labels, taints, and topology domains
Configuration Steps¶
To configure pod scheduling features, follow the steps below:
1. Copy the Scheduling Configuration File¶
| Bash | |
|---|---|
This file contains all scheduling-related configurations including node selectors, tolerations, node affinity, topology spread constraints, and pod disruption budgets.
2. Configure Global Scheduling Settings (Optional)¶
Edit config/custom-vars/vars.kubernetes.scheduling.yml and uncomment the global settings to apply scheduling rules to all Privacera services.
Note: All values shown below are sample values for reference. Do not use these values directly. You must identify and use values specific to your Kubernetes environment and configuration (node labels, taints, topology domains, etc.).
Global Node Selector¶
To schedule all pods on nodes with specific labels:
| YAML | |
|---|---|
Global Tolerations¶
To allow all pods to schedule on nodes with specific taints:
| YAML | |
|---|---|
Supported operators: Equal, Exists
Supported effects: NoSchedule, PreferNoSchedule, NoExecute
Global Node Affinity¶
For advanced node selection with multiple matching rules:
| YAML | |
|---|---|
Scheduling Types:
requiredDuringSchedulingIgnoredDuringExecution: Hard requirement (pods won't schedule if not met)preferredDuringSchedulingIgnoredDuringExecution: Soft preference (best effort)
Match Operators: In, NotIn, Exists, DoesNotExist, Gt, Lt
Global Pod Topology Spread¶
To distribute pods evenly across zones and nodes:
| YAML | |
|---|---|
Parameters:
topologykey: Node label representing the topology domain (zone, hostname, rack, etc.)maxskew: Maximum allowed difference in pod count between topology domainswhenunsatisfiable:DoNotSchedule(hard) orScheduleAnyway(soft)
Global Pod Disruption Budget¶
To protect services during voluntary disruptions:
| YAML | |
|---|---|
Note: This enables Pod Disruption Budgets with default specifications. To customize the PDB specification (minAvailable/maxUnavailable), use service-specific configuration (see below).
3. Configure Service-Specific Scheduling (Optional)¶
To override global settings or customize specific features for individual services, locate and uncomment the respective service configuration section in the file.
Example: Configure scheduling for Ranger Admin
Locate the Ranger Admin section in vars.kubernetes.scheduling.yml:
Uncomment the lines you need and update the values based on your Kubernetes environment setup and configuration to make it work.
Pod Disruption Budget Customization:
The Pod Disruption Budget (PDB) specification is service-specific only and allows you to customize availability requirements during voluntary disruptions:
minAvailable: Minimum number (or percentage) of pods that must remain available- Example:
minAvailable: 2- Keep at least 2 pods running -
Example:
minAvailable: "50%"- Keep at least 50% of pods running -
maxUnavailable: Maximum number (or percentage) of pods that can be unavailable - Example:
maxUnavailable: 1- Allow at most 1 pod to be unavailable - Example:
maxUnavailable: "25%"- Allow at most 25% of pods to be unavailable
Note: Use either
minAvailableormaxUnavailable, not both. Choose the option that best fits your availability requirements.The configuration file contains similar sections for all Privacera services (Portal, Discovery, Kafka, Solr, etc.). Follow the same pattern: uncomment the relevant service section and modify values for your environment.
4. Deploy or Update Privacera Manager¶
After copying the configuration file and making necessary changes:
For new/fresh installation:
| Bash | |
|---|---|
For upgrade scenario (existing installation):
Run the following command to run the post install steps:
This will apply the scheduling configurations to the Privacera services.
5. Verify the Configuration¶
Once deployment completes, verify that the scheduling configurations are applied:
Check pod placement:
| Bash | |
|---|---|
This shows which nodes the pods are running on.
Check pod scheduling details:
| Bash | |
|---|---|
Look for sections like:
Node-SelectorsTolerationsNode AffinityTopology Spread Constraints
Check pod disruption budgets:
| Bash | |
|---|---|
Troubleshooting¶
Pods Stuck in Pending State¶
If pods are not scheduling:
-
Check node labels:
Verify that your node selector labels exist on nodes.Bash -
Check node taints:
Ensure tolerations match the node taints.Bash -
Check pod events:
Look for scheduling errors in the Events section.Bash
Uneven Pod Distribution¶
If pods are not distributed as expected:
-
Check topology labels:
Verify topology labels exist on nodes.Bash -
Review topology configuration:
- Lower
maxskewfor stricter distribution - Change
whenunsatisfiabletoDoNotSchedulefor hard enforcement - Ensure sufficient nodes in each topology domain
Disabling Configurations¶
To disable any scheduling feature:
- Identify the
_ENABLEflag for the required service which you want to disable - Set it to
"false"in the configuration file - Save the changes
- Apply the changes:
Run the following command to run the post install steps:
Best Practices¶
- Start with global configuration for consistent scheduling across all services
- Use service-specific overrides only when needed (e.g., database pods on specific node types, custom PDB specifications)
- Always enable topology spread constraints in production for high availability
- Enable pod disruption budgets to protect against service interruptions during maintenance
- Customize PDB specifications for critical services based on their replica counts and availability requirements
- For services with 2 replicas: Use
minAvailable: 1ormaxUnavailable: 1 - For services with 3+ replicas: Use
minAvailable: 2or percentage-based values likemaxUnavailable: "33%" - Test in non-production environments before applying to production
- Document your node labels and taints for team reference
- Use
ScheduleAnywayfor topology spread in initial setup, then switch toDoNotScheduleafter verifying distribution
Additional Resources¶
- Kubernetes Node Selectors
- Kubernetes Taints and Tolerations
- Kubernetes Node Affinity
- Kubernetes Topology Spread Constraints
- Kubernetes Pod Disruption Budgets
- Previous: Advanced Configuration