Home > Software design >  Getting errors when using "imagePullSecrets" in my kubernetes deployment
Getting errors when using "imagePullSecrets" in my kubernetes deployment

Time:12-10

I have a kind:deployment file, and they are forcing the image to be defined down here in the "initContainers", but I can't get my image in my own registry to load. If I try to put

  imagePullSecrets:
  - name: regcred

in line with the "image" down below, I get error converting YAML to JSON: yaml: found character that cannot start any token. And I get the same thing if I move it around to different spots. Any ideas how I can use imagePullCreds here?

spec:
  template:
    metadata:
    spec:
      initContainers:
      - env:
        - name: "BOOTSTRAP_DIRECTORY"
          value: "/bootstrap-data"
        image: "my-custom-registry.com/my-image:1.6.24-SNAPSHOT"
        imagePullPolicy: "Always"
        name: "bootstrap"

CodePudding user response:

Check if you are using tabs for indentation; YAML doesn't allow tabs; it requires spaces.

Also, You should use imagePullSecrets under spec instead of under containers.

spec:
  template:
    metadata:
    spec:
      imagePullSecrets:
      - name: regcred
      initContainers:
  • Related