Kubernetes deployment configuration

David Kumar Jan 2026
5 tabs
apiVersion: apps/v1
kind: Deployment
metadata:
  name: user-service
  labels:
    app: user-service
spec:
  replicas: 3
  selector:
    matchLabels:
      app: user-service
  template:
    metadata:
      labels:
        app: user-service
    spec:
      containers:
      - name: user-service
        image: myregistry/user-service:1.0.0
        ports:
        - containerPort: 8080
          name: http
        - containerPort: 9090
          name: management
        env:
        - name: SPRING_PROFILES_ACTIVE
          value: "prod"
        - name: SPRING_DATASOURCE_URL
          valueFrom:
            configMapKeyRef:
              name: user-service-config
              key: database.url
        - name: SPRING_DATASOURCE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: user-service-secret
              key: database.password
        resources:
          requests:
            memory: "512Mi"
            cpu: "250m"
          limits:
            memory: "1Gi"
            cpu: "500m"
        livenessProbe:
          httpGet:
            path: /actuator/health/liveness
            port: 9090
          initialDelaySeconds: 30
          periodSeconds: 10
          timeoutSeconds: 5
          failureThreshold: 3
        readinessProbe:
          httpGet:
            path: /actuator/health/readiness
            port: 9090
          initialDelaySeconds: 20
          periodSeconds: 5
          timeoutSeconds: 3
          failureThreshold: 3
5 files · yaml Explain with highlit

Kubernetes orchestrates containerized applications at scale. Deployments manage ReplicaSets ensuring desired pod count. Services expose pods with stable endpoints. ConfigMaps externalize configuration. Secrets store sensitive data. Resource limits prevent resource exhaustion. Liveness probes detect failed containers; readiness probes control traffic. Horizontal Pod Autoscaler scales based on metrics. Ingress manages external access. Namespaces organize resources. Helm charts template Kubernetes manifests. Kubernetes enables zero-downtime deployments, self-healing, and automatic scaling. Spring Boot apps integrate via health endpoints, graceful shutdown. Proper Kubernetes configuration ensures high availability, efficient resource usage, and operational excellence in production.