kubernetes-installation/DOCKER-PRIVREGISTRY.md

33 lines
743 B
Markdown
Raw Normal View History

2021-10-22 10:26:56 +07:00
# Docker Private Registry for Kubernetes
2021-10-22 10:52:40 +07:00
- Create secret
2021-10-22 10:26:56 +07:00
```shell
kubectl create secret generic regcred \
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
--type=kubernetes.io/dockerconfigjson
```
2021-10-22 10:52:40 +07:00
OR
```shell
kubectl create secret docker-registry regcred --docker-server=registry.kh.cubetiqs.com --docker-username=sombochea --docker-password=<your-pword> --docker-email=sombochea@cubetiqs.com
```
- View your secret
```shell
kubectl get secret regcred --output="jsonpath={.data.\.dockerconfigjson}" | base64 --decode
```
- Create sample pod
```yaml
apiVersion: v1
kind: Pod
metadata:
name: private-reg
spec:
containers:
- name: private-reg-container
image: <your-private-image>
imagePullSecrets:
- name: regcred
```