Resource Configuration

Deployment

  • Kubernetes doc: Deployments

  • replicas

    • can be omitted

    • defaults to 1

  • all three labels must exactly match

  • containerPort is for information purposes only and can be omitted

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: my-namespace
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:1.14.2
        ports:
        - containerPort: 80

Service

  • Kubernetes doc: Service

  • spec.selector.app must reference the label(-s) of the deployment (pod)

  • targetPort is the port of the pod

  • port is the port of the service

apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  namespace: my-namespace
spec:
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: nginx

Secret

PersistentVolumeClaim

IngressRoute

Middleware

Namespace

apiVersion: v1
kind: Namespace
metadata:
  name: my-namespace

ConfigMap

Mount a File not a Directory

          volumeMounts:
            - name: <config_map_name>
              mountPath: /<path>/<filename>
              subPath: <filename>
              readOnly: true