Directly launching a Pod

In Kubernetes Pod is considered a low level construct. Directly instantiating Pods is not recommended. Instead there are higher level controllers available to launch and maintain Pods. Consider using Deployment, DaemonSet, StatefulSet, Job or CronJob instead.

Affected Resources: Pod

Example

apiVersion: v1 kind: Pod metadata: name: frontend spec: containers: - name: nginx image: nginx:1.21.6

Resolution

  • Use Deployment instead of Pods.
  • Resolution Example

    apiVersion: apps/v1 kind: Deployment metadata: name: frontend spec: replicas: 1 selector: matchLabels: tier: frontend template: metadata: labels: tier: frontend spec: containers: - name: nginx image: nginx:1.21.6
    Share this article on:
    message