<p>I'm trying to pull a private image from docker hub and every time I get the error "ImagePullBackOff" using describe on the pods I see the error "unauthorized: incorrect username or password", I created the secret in the cluster using the following guide: <a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/</a> using the cli method with the correct credentials (I checked and I can login on the website with these one) and this is my yaml file.</p>

<pre><code>apiVersion: apps/v1
kind: Deployment
metadata:
  name: app-typescript
  labels:
    app: app-typescript
spec:
  selector:
      matchLabels:
        app: app-typescript
  replicas: 1
  minReadySeconds: 15
  strategy:
    type: RollingUpdate    
    rollingUpdate:
      maxUnavailable: 1                                   
      maxSurge: 1 
  template:
    metadata:
      labels:
        app: app-typescript
    spec:
      containers:
      - name: api
        image: dockerhuborg/api:latest
        imagePullPolicy: Always
        env:
          - name: "ENV_TYPE"
            value: "production"
          - name: "NODE_ENV"
            value: "production"
          - name: "MONGODB_URI"
            value: "mongodb://mongo-mongodb/db"
        ports:
        - containerPort: 4000
      imagePullSecrets:
      - name: regcred
</code></pre>

<p>I found a solution, apparently the problem is that docker hub use different domains for login and containers pulling, so you must edit your secret created with the kubectl command and replace the base64 of .dockerconfigjson with an encoded base64 version of this json (yeah I know maybe I added too much domain but I'm trying to fix this sh*t from about 2 days I don't have patience anymore to find the exact ones) </p>

<pre><code>{
    "auths":{
        "https://index.docker.io/v1/":{
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        },
        "auth.docker.io":{
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        },
        "registry.docker.io":{
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        },
        "docker.io":{
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        },
        "https://registry-1.docker.io/v2/": {
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        },
        "registry-1.docker.io/v2/": {
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        },
        "registry-1.docker.io": {
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        },
        "https://registry-1.docker.io": {
            "username":"user",
            "password":"password",
            "email":"yourdockeremail@gmail.com",
            "auth":"base64 of string user:password"
        }
    }
}
</code></pre>
