I'm trying to deploy a Kubernetes container by pulling an image from a remote registry (quay.io). While it works perfectly when deploying a pod, there is an unexpected problem with quay authorization when deploying it as a deployment. Don't know what misconfiguration in the yaml is causing the issue. Anyway, here's the working pod yaml:
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: quay.io/xxx/yyy
imagePullPolicy: Always
imagePullSecrets:
- name: test-secret
and here's the not working deployment yaml:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: random-name-deployment
namespace: test-ns
spec:
selector:
matchLabels:
app: random-name
replicas: 1
template:
metadata:
labels:
app: random-name
spec:
restartPolicy: Always
containers:
- name: random-name
image: quay.io/xxx/yyy
imagePullPolicy: Always
ports:
- containerPort: 8080
resources:
requests:
memory: 10Mi
cpu: 0.1
limits:
memory: 10Mi
cpu: 0.1
volumeMounts:
- mountPath: /etc/config/config.yaml
name: random-name-config
subPath: config.yaml
imagePullSecrets:
- name: test-secret
volumes:
- name: random-name-config
configMap:
name: random-name-config
It fails with an error:
kubectl describe:
Failed to pull image "quay.io/xxx/yyy": rpc error: code = Unknown desc = Error response from daemon: unauthorized: access to the requested resource is not authorized
However the secret seems to be loaded properly (and the secret has not changed in between deploying the pod and deployment - in the first scenario authorization works like a charm):
kubectl get -o yaml:
(...)
imagePullSecrets:
- name: test-secret
What do I do wrong? Any sugestions will be greatly appreciated, thanks!