Updated the sample for pod and svc
This commit is contained in:
parent
5d23859c51
commit
65f0a7ccc7
@ -1,7 +1,33 @@
|
|||||||
# Docker Private Registry for Kubernetes
|
# Docker Private Registry for Kubernetes
|
||||||
|
|
||||||
|
- Create secret
|
||||||
```shell
|
```shell
|
||||||
kubectl create secret generic regcred \
|
kubectl create secret generic regcred \
|
||||||
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
|
--from-file=.dockerconfigjson=$HOME/.docker/config.json \
|
||||||
--type=kubernetes.io/dockerconfigjson
|
--type=kubernetes.io/dockerconfigjson
|
||||||
```
|
```
|
||||||
|
|
||||||
|
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
|
||||||
|
```
|
28
sample/private-pod.yaml
Normal file
28
sample/private-pod.yaml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: myapp
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: myapp
|
||||||
|
image: registry.kh.cubetiqs.com/myapp
|
||||||
|
imagePullSecrets:
|
||||||
|
- name: regcred
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: myapp
|
||||||
|
namespace: default
|
||||||
|
labels:
|
||||||
|
app: myapp
|
||||||
|
spec:
|
||||||
|
externalTrafficPolicy: Local
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
port: 80
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 80
|
||||||
|
selector:
|
||||||
|
app: myapp
|
||||||
|
type: LoadBalancer
|
Loading…
Reference in New Issue
Block a user