Kubernetes YAML Manifests

A collection of production-ready Kubernetes manifest examples for various workload types and configuration patterns.

Deployment

Standard Deployment with resource limits, probes, and environment variables

deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: web-application
  namespace: production
  labels:
    app: web-application
    tier: frontend
spec:
  replicas: 3
  selector:
    matchLabels:
      app: web-application
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      labels:
        app: web-application
        tier: frontend
    spec:
      containers:
      - name: web-application
        image: nginx:1.21-alpine
        imagePullPolicy: Always
        ports:
        - containerPort: 80
          name: http
        resources:
          limits:
            cpu: "500m"
            memory: "512Mi"
          requests:
            cpu: "100m"
            memory: "128Mi"
        livenessProbe:
          httpGet:
            path: /health
            port: http
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /ready
            port: http
          initialDelaySeconds: 5
          periodSeconds: 5
        env:
        - name: NODE_ENV
          value: "production"
        volumeMounts:
        - name: config-volume
          mountPath: /etc/nginx/conf.d
      volumes:
      - name: config-volume
        configMap:
          name: nginx-config
deploymentproductionnginxprobes

StatefulSet

StatefulSet configuration for database deployments with persistent volumes

statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: postgres-db
  namespace: database
  labels:
    app: postgres-db
spec:
  serviceName: "postgres"
  replicas: 3
  selector:
    matchLabels:
      app: postgres-db
  template:
    metadata:
      labels:
        app: postgres-db
    spec:
      terminationGracePeriodSeconds: 60
      containers:
      - name: postgres
        image: postgres:14.2
        ports:
        - containerPort: 5432
          name: postgres
        env:
        - name: POSTGRES_USER
          valueFrom:
            secretKeyRef:
              name: postgres-secret
              key: username
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              name: postgres-secret
              key: password
        volumeMounts:
        - name: postgres-data
          mountPath: /var/lib/postgresql/data
  volumeClaimTemplates:
  - metadata:
      name: postgres-data
    spec:
      accessModes: [ "ReadWriteOnce" ]
      storageClassName: "longhorn" # Example storage class
      resources:
        requests:
          storage: 10Gi
statefulsetdatabasepostgrespersistentvolume

Helm Charts

Curated Helm charts for deploying common applications and services on Kubernetes.

Helm chart resources coming soon...

Kubernetes Operators

Examples and guides for using Kubernetes Operators to automate application lifecycle management.

Operator resources coming soon...

Kubernetes Best Practices

Tips, tricks, and best practices for managing Kubernetes clusters effectively and securely.

  • Security Hardening

    Implement Role-Based Access Control (RBAC), Network Policies, and Secrets Management.

  • Resource Management

    Define resource requests and limits for all workloads to ensure stability and fair resource allocation.