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

    Need other validation rules?

    Please let us know if there are other built-in validation rules you would like to see in Kubevious to detect misconfigurations and violations to best practices. Optionally, you can provide your details so we can reach out to you with follow-up questions.

    Share this article on:
    message