Kubernetes Configuration
Cluster Setup
Kubernetes clusters can be configured in various environments:
- GKE (Google Kubernetes Engine)
- EKS (Amazon Elastic Kubernetes Service)
- AKS (Azure Kubernetes Service)
- On-Premises (kubeadm, Rancher, etc.)
- Local Development (Minikube, Kind, k3s)
Cluster Configuration by Environment
development → 2 nodes (2 CPU, 8GB RAM per node)
staging → 3 nodes (4 CPU, 16GB RAM per node)
production → 5+ nodes (8 CPU, 32GB RAM per node)Node count and specs should be adjusted based on application requirements.
Namespace Structure
In microservice architecture, it’s common to separate namespaces by service.
| |
Check namespaces:
| |
Deployment Manifests
Basic Deployment
Basic Deployment configuration example for Spring Boot applications.
| |
Service
| |
ConfigMap
| |
Secret
| |
HPA (Horizontal Pod Autoscaler)
| |
Ingress
Ingress configuration example for accessing internal cluster services from outside.
| |
Essential Commands
| |
Deployment Strategies
Rolling Update (Default)
| |
Blue-Green Deployment
| |
JVM Warm-up Configuration
Configuration to resolve cold start issues:
| |
For more details, see the blog post.
Resource Optimization
CPU/Memory Requests vs Limits
| |
Recommendations:
- requests should be 80-90% of actual usage
- limits should be based on peak usage
- CPU limits should be set carefully as they can cause throttling
Troubleshooting
Pod Won’t Start
| |
OOMKilled Occurs
When Pod is terminated due to memory shortage:
| |
Security
1. RBAC (Role-Based Access Control)
Apply principle of least privilege:
| |
2. Pod Security Standards
Apply Pod security policies:
| |
3. Secret Encryption and Management
| |
4. Network Policy
Default deny + explicit allow:
| |
5. Image Pull Policy and Verification
| |
Performance
1. Resource Requests/Limits Optimization
| |
2. HPA (Horizontal Pod Autoscaler) Configuration
| |
3. Node Affinity and Pod Topology
| |
4. Efficient Probe Configuration
| |
Reliability
1. PDB (Pod Disruption Budget)
| |
2. Rolling Update Strategy
| |
3. Monitoring and Alerts
| |
Checklist
Security
- Are minimum necessary permissions granted with RBAC?
- Are Pod Security Standards applied?
- Are Secrets managed with External Secret Manager?
- Is traffic restricted with Network Policy?
- Are containers running as non-root user?
- Are image digests being used?
Performance
- Are Resource Requests/Limits properly configured?
- Is HPA configured?
- Is Node Affinity properly configured?
- Are Probe settings optimized?
Reliability
- Is PDB configured?
- Is Rolling Update strategy appropriate?
- Are there at least 3 replicas?
- Are monitoring and alerts configured?
- Is Revision History maintained?