Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagePullSecrets not working with Kind deployment

Tags:

kubernetes

I'm tying to create a deployment with 3 replicas, whcih will pull image from a private registry. I have stored the credentials in a secret and using the imagePullSecrets in the deployment file. Im getting below error in the deploy it.

error: error validating "private-reg-pod.yaml": error validating data: [ValidationError(Deployment.spec): unknown field "containers" in io.k8s.api.apps.v1.DeploymentSpec, ValidationError(Deployment.spec): unknown field "imagePullSecrets" in io.k8s.api.apps.v1.DeploymentSpec, ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec, ValidationError(Deployment.spec): missing required field "template" in io.k8s.api.apps.v1.DeploymentSpec]; if you choose to ignore these errors, turn validation off with --validate=false

Any help on this?

Below is my deployment file :

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: test-pod-deployment
  labels:
    app: test-pod
spec:
  replicas: 3
  selector:
    matchLabels:
      app: test-pod
  template:
    metadata:
      labels:
        app: test-pod
    spec:
      containers:
      - name: test-pod
    image: <private-registry>
  imagePullSecrets:
  - name: regcred

Thanks, Sundar

like image 307
Sun Avatar asked Sep 05 '18 20:09

Sun


People also ask

What is kind deployment in Kubernetes?

A Kubernetes Deployment tells Kubernetes how to create or modify instances of the pods that hold a containerized application. Deployments can help to efficiently scale the number of replica pods, enable the rollout of updated code in a controlled manner, or roll back to an earlier deployment version if necessary.

What is the smallest deployable resource in Kubernetes?

Pods are the smallest deployable units of computing that you can create and manage in Kubernetes. A Pod (as in a pod of whales or pea pod) is a group of one or more containers, with shared storage and network resources, and a specification for how to run the containers.


1 Answers

Very common issue with kubernetes Deployment.

The valid format for pulling image from private repository in your Kubernetes Deployment file is:

spec:
  imagePullSecrets:
  - name: <your secret name>    
  containers:
like image 122
itmaven Avatar answered Sep 28 '22 17:09

itmaven