Every K8s object a global product company needs — with production-grade YAML, real resource limits, multi-region patterns, and declarative best practices.
// object relationship map — click any node to jump
14objects covered
14prod-grade YAMLs
6categories
MNCscale patterns
🚀
Workload Objectspods · deployments · statefulsets · daemonsets · jobs
Namespaceglobalcorp-productionTenant isolation for multi-region, multi-team cluster▾
// why it matters
Scope boundary — every resource lives inside a namespace. MNCs use one namespace per team/env/region.
LimitRange — set default CPU/memory so any pod without requests gets sane defaults.
ResourceQuota — cap total CPU, memory, and object count per team/namespace.
Labels — used by RBAC, NetworkPolicy, and cost allocation tools (e.g. Kubecost).
Servicepayment-service-svcStable DNS + load balancing for internal and external traffic▾
// service types
ClusterIP (default) — internal-only stable IP. Use for service-to-service calls.
LoadBalancer — provisions cloud LB. Use for external entry points requiring raw TCP/UDP (e.g. gRPC at edge).
Headless (clusterIP: None) — direct pod DNS for StatefulSets like Kafka, Postgres.
ClusterIPstable DNS
service-payment.yaml
apiVersion:v1kind:Servicemetadata:name:payment-service-svcnamespace:globalcorp-productionannotations:service.beta.kubernetes.io/aws-load-balancer-type:nlbspec:type:ClusterIPselector:app:payment-serviceports:- name:httpport:80targetPort:8080protocol:TCP- name:grpcport:9090targetPort:9090protocol:TCPsessionAffinity:None---# Headless service for StatefulSet DNSapiVersion:v1kind:Servicemetadata:name:postgres-headlessnamespace:globalcorp-productionspec:clusterIP:Noneselector:app:postgresports:- port:5432
RBACpayment-service-rbacLeast-privilege service account with scoped role and binding▾
// least privilege principle
Dedicated ServiceAccount — never use the default SA. Each service gets its own identity with minimal permissions.
Role (namespaced) — prefer Role over ClusterRole unless the service genuinely needs cluster-wide access.
Workload Identity — bind SA to cloud IAM (AWS IRSA / GCP Workload Identity) for cloud API access without static keys.
least-privilegeIRSA
rbac-payment.yaml
apiVersion:v1kind:ServiceAccountmetadata:name:payment-service-sanamespace:globalcorp-productionannotations:# AWS IRSA — maps SA to IAM roleeks.amazonaws.com/role-arn:arn:aws:iam::123456:role/payment-service-role---apiVersion:rbac.authorization.k8s.io/v1kind:Rolemetadata:name:payment-service-rolenamespace:globalcorp-productionrules:- apiGroups:[""]resources:["secrets"]resourceNames:["payment-secrets"]verbs:["get"]- apiGroups:[""]resources:["configmaps"]resourceNames:["payment-config"]verbs:["get", "list"]---apiVersion:rbac.authorization.k8s.io/v1kind:RoleBindingmetadata:name:payment-service-rbnamespace:globalcorp-productionsubjects:- kind:ServiceAccountname:payment-service-sanamespace:globalcorp-productionroleRef:apiGroup:rbac.authorization.k8s.iokind:Rolename:payment-service-role
📈
Autoscaling Objectshpa · vpa · pdb · keda
HorizontalPodAutoscalerpayment-hpaScale pods on CPU, memory, and custom Prometheus metrics▾
// scale strategies
CPU + memory — dual-metric HPA. Scale out when either threshold is crossed; scale in only when both drop.
KEDA — event-driven autoscaler for queue-depth-based scaling (Kafka lag, SQS queue length).
stabilizationWindowSeconds — prevents flapping by requiring metrics to stabilize before scaling in.