---
# System prepended metadata

title: PodDefaults with ImagePullSecrets

---

# PodDefaults with ImagePullSecrets

- Image: gcr.io/arrikto/admission-webhook:v1.0.0-arr-122-g745c76e


- Create ImagePullSecret: 

  **Of course you will need to have a proper docker `config.json`
in place of `/home/minikf/.docker/config.json`**
```bash
kubectl -n kubeflow-user create secret generic regcred \
  --from-file=.dockerconfigjson=/home/minikf/.docker/config.json \
  --type=kubernetes.io/dockerconfigjson
```

- Create the PodDefault:

```yaml
apiVersion: kubeflow.org/v1alpha1
kind: PodDefault
metadata:
  name: access-prv-images
  namespace: kubeflow-user
spec:
  desc: Allow access to a private registry
  imagePullSecrets:
  - name: regcred
  selector:
    matchLabels:
      access-prv-registry: "true"
```


- Test by creating a Pod:

```yaml
apiVersion: v1
kind: Pod
metadata:
  name: poddefault-test
  namespace: kubeflow-user
  labels:
    access-prv-registry: "true"
spec:
  containers:
  - name: main
    image: k8s.gcr.io/echoserver:1.4
```