83 lines
1.7 KiB
Plaintext
83 lines
1.7 KiB
Plaintext
kubectl create deploy nginx --image nginx --dry-run=client -o yaml >nginx-deploy.yaml
|
|
vi nginx-deploy.yaml
|
|
# add volume mounts and volumes from configMap
|
|
|
|
# create config Map
|
|
echo Linuxhotel >index.html
|
|
|
|
kubectl create configmap htdocs --from-file index.html=index.html --dry-run=client -o yaml >htdocs-cm.yaml
|
|
|
|
kubectl -n nginx apply -f htdocs-cm.yaml
|
|
kubectl -n nginx apply -f nginx-deploy.yaml
|
|
|
|
kubectl -n nginx exec -ti nginx-6fc76484c-q8tmd -- /bin/sh
|
|
# more /usr/share/nginx/html/index.html
|
|
|
|
kubectl edit -n nginx cm htdocs
|
|
# change content
|
|
apiVersion: v1
|
|
data:
|
|
index.html: |
|
|
Linuxhotel Cloud Native Base Camp
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: htdocs
|
|
|
|
# See it change at running pods!
|
|
|
|
kubectl -n nginx exec -ti nginx-6fc76484c-q8tmd -- /bin/sh
|
|
# more /usr/share/nginx/html/index.html
|
|
Linuxhotel Cloud Native Base Camp
|
|
|
|
|
|
|
|
|
|
htdocs-cm.yaml
|
|
|
|
apiVersion: v1
|
|
data:
|
|
index.html: |
|
|
Linuxhotel
|
|
kind: ConfigMap
|
|
metadata:
|
|
creationTimestamp: null
|
|
name: htdocs
|
|
|
|
|
|
|
|
|
|
nginx-deploy.yaml
|
|
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
creationTimestamp: null
|
|
labels:
|
|
app: nginx
|
|
name: nginx
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: nginx
|
|
strategy: {}
|
|
template:
|
|
metadata:
|
|
creationTimestamp: null
|
|
labels:
|
|
app: nginx
|
|
spec:
|
|
containers:
|
|
- image: nginx
|
|
name: nginx
|
|
resources: {}
|
|
volumeMounts:
|
|
- name: htdocs
|
|
mountPath: /usr/share/nginx/html
|
|
volumes:
|
|
- name: htdocs
|
|
configMap:
|
|
name: htdocs
|
|
status: {}
|
|
|