This commit is contained in:
nutzer26
2022-12-16 12:21:57 +01:00
parent 199a7e11b5
commit 8ee05cb88d
60 changed files with 3516 additions and 2 deletions

82
k8s/config_map Normal file
View File

@@ -0,0 +1,82 @@
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: {}