Production K8s vs. Development Environments
Running Kubernetes in production is a completely different problem from local Minikube. You need to consider high availability, security, monitoring, and cost optimization.
Managed vs. Self-Managed
| Approach | Pros | Cons | Recommended for |
|---|---|---|---|
| EKS/GKE/AKS | No control plane management | Cost, vendor lock-in | Most organizations |
| kubeadm | Full control | High operational overhead | On-premises |
| k3s | Lightweight, edge-friendly | Limited features | IoT, small-scale |
Node Group Design
nodeGroups:
- name: system
instanceType: m5.large
desiredCapacity: 3
minSize: 3
maxSize: 5
- name: app-general
instanceType: c5.2xlarge
desiredCapacity: 3
minSize: 2
maxSize: 20
spot: true # 비용 절감Pod Anti-Affinity (High Availability)
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchLabels:
app: my-app
topologyKey: kubernetes.io/hostname
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedulePodDisruptionBudget
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: my-app-pdb
spec:
minAvailable: 2
selector:
matchLabels:
app: my-appResource Settings (Required)
resources:
requests:
cpu: "250m"
memory: "256Mi"
limits:
cpu: "500m"
memory: "512Mi"Always set requests and limits. Without them, noisy-neighbor issues can take down an entire node.
Security Hardening
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 2000
containers:
- name: app
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: ["ALL"]Monitoring Stack
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm install monitoring prometheus-community/kube-prometheus-stack \
--namespace monitoring --create-namespaceEssential alerts: node CPU > 80%, memory > 85%, Pod restarts > 5/hour, PVC utilization > 80%
The core of production Kubernetes operations is automation. Build a self-healing environment with HPA, Cluster Autoscaler, and GitOps.
References: Official Documentation
The primary source for the behavior, configuration, and errors covered in this post is the official documentation below. Check there for version-specific options and exact behavior.
Nodelog는 모든 콘텐츠의 내용과 출처를 공개 전에 검토합니다. 환경(OS·버전)에 따라 결과가 달라질 수 있는 기술 정보는 공식 문서와 함께 확인하며, 검토 기준과 정정 원칙은 편집 정책에서 안내합니다. 오류를 발견하시면 이메일로 제보해 주세요 — 확인 후 신속히 정정합니다.
Comments
Be the first to comment.