Create Pod Yaml File

Hello there
I trie create this pod, but received this error
apiVersion: v1
kind: Pod
metadata:
labels:
run: giropops
name: giropops
spec:
containers:

  • image: ubuntu
    name: ubuntu
    args:
    • sleep
    • “1800”
      resources:
      limits:
      cpu: “0.5”
      memory: “128Mi”
      requests:
      cpu: “0.3”
      memory: “64Mi”
      dnsPolicy: ClusterFirst
      restartPolicy: Always

#######################
Error from server (BadRequest): error when creating “pod-limitado.yaml”: Pod in version “v1” cannot be handled as a Pod: strict decoding error: unknown field “spec.containers[0].dnsPolicy”

Hi @Rogerio-De-Jose-Paix

That error means your indentation is incorrect. It should be as follows - and please when posting code, use code blocks (like below) so we can see how you indented it originally.

apiVersion: v1
kind: Pod
metadata:
  name: giropops 
  labels:
    run: giropops
    name: giropops
spec:
  containers:
  - image: ubuntu
    name: ubuntu
    args:
    - sleep
    - "1800"
    resources:
      limits:
        cpu: 0.5
        memory: 128Mi
      requests:
        cpu: 0.3
        memory: 64Mi
  dnsPolicy: ClusterFirst
  restartPolicy: Always

Please also see https://github.com/kodekloudhub/community-faq/blob/main/docs/yaml-faq.md, especially the bit about dealing with errors.