How to get the path of an item in a list in yaml?

Viewed 12

I have the following yaml deployment of a pod in Kubernetes:

apiVersion: v1
kind: Pod
metadata:
  name: ubuntu
  labels:
    app: ubuntu
spec:
  containers:
  - name: ubuntu
    image: ubuntu:latest
    command: ["/bin/sleep", "1d"]
    imagePullPolicy: IfNotPresent

I have a script that changes the imagePullPolicy from IfNotPresent to Always, and for that it needs the path, I tried:

/spec/containers[0]/imagePullPolicy
/spec/containers/imagePullPolicy
/spec/containers[name:ubuntu]/imagePullPolicy

However in all 3 cases I got an error saying the path is invalid. How exactly do I get the right path?

0 Answers
Related