Kubernetes pod/deploy/sts/ds example
February 21, 2023

Pod with probe,resource, nodeName, tolerations, emptyDir

Пример пода с большим количеством настроек.

cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Pod
metadata:
  name: cam-nginx
  labels:
    app: nginx
    env: prod
  annotations:
    author: cameda
spec:
  containers:
  - name: cam-nginx
    image: nginx:latest
    imagePullPolicy: IfNotPresent
    resources:
      requests:
        cpu: 300m
        memory: 300Mi
      limits:
        memory: 500Mi
    ports:
    - containerPort: 80
    - containerPort: 443
    livenessProbe:
      failureThreshold: 10
      successThreshold: 1
      httpGet:
        path: /
        port: 80
      periodSeconds: 10
      timeoutSeconds: 1
      initialDelaySeconds: 5
    readinessProbe:
      failureThreshold: 3
      successThreshold: 1
      exec:
        command:
        - curl
        - http://127.0.0.1:80
      periodSeconds: 10
      timeoutSeconds: 1
      initialDelaySeconds: 7
    volumeMounts:
    - name: cam-volume
      mountPath: /mnt/cameda
  restartPolicy: OnFailure
  nodeName: cl14iev9l04rfqleuqa5-iguw
  tolerations:
  - key: "cam"
    operator: "Exists"
    effect: "NoSchedule"
  - key: "cam"
    operator: "Exists"
    effect: "NoExecute"
  volumes:
  - name: cam-volume
    emptyDir: {}
EOF
kubectl get po