新增learn-kubernetes(https://github.com/yyong-brs/learn-kubernetes)相关文件
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f sleep/sleep.yaml
|
||||
kubectl exec deploy/sleep -- sh -c 'echo ch05 > /file.txt; ls /*.txt'
|
||||
kubectl get pod -l app=sleep -o jsonpath='{.items[0].status.containerStatuses[0].containerID}'
|
||||
kubectl exec -it deploy/sleep -- killall5
|
||||
kubectl get pod -l app=sleep -o jsonpath='{.items[0].status.containerStatuses[0].containerID}'
|
||||
kubectl exec deploy/sleep -- ls /*.txt
|
||||
@@ -0,0 +1,9 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f sleep/sleep-with-emptyDir.yaml
|
||||
kubectl exec deploy/sleep -- ls /data
|
||||
kubectl exec deploy/sleep -- sh -c 'echo ch05 > /data/file.txt; ls /data'
|
||||
kubectl get pod -l app=sleep -o jsonpath='{.items[0].status.containerStatuses[0].containerID}'
|
||||
kubectl exec deploy/sleep -- killall5
|
||||
kubectl get pod -l app=sleep -o jsonpath='{.items[0].status.containerStatuses[0].containerID}'
|
||||
kubectl exec deploy/sleep -- cat /data/file.txt
|
||||
@@ -0,0 +1,6 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f pi/v1/
|
||||
kubectl wait --for=condition=Ready pod -l app=pi-web
|
||||
kubectl get svc pi-proxy -o jsonpath='http://{.status.loadBalancer.ingress[0].*}:8080/?dp=30000'
|
||||
kubectl exec deploy/pi-proxy -- ls -l /data/nginx/cache
|
||||
@@ -0,0 +1,4 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl delete pod -l app=pi-proxy
|
||||
kubectl exec deploy/pi-proxy -- ls -l /data/nginx/cache
|
||||
10
learn/learn-kubernetes-master/kiamol/ch05/exercises/5.05.sh
Normal file
10
learn/learn-kubernetes-master/kiamol/ch05/exercises/5.05.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f pi/nginx-with-hostPath.yaml
|
||||
kubectl exec deploy/pi-proxy -- ls -l /data/nginx/cache
|
||||
|
||||
#
|
||||
curl http://localhost:8080/?dp=30000
|
||||
|
||||
kubectl delete pod -l app=pi-proxy
|
||||
kubectl exec deploy/pi-proxy -- ls -l /data/nginx/cache
|
||||
@@ -0,0 +1,6 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f sleep/sleep-with-hostPath.yaml
|
||||
kubectl exec deploy/sleep -- ls -l /var/log
|
||||
kubectl exec deploy/sleep -- ls -l /node-root/var/log
|
||||
kubectl exec deploy/sleep -- whoami
|
||||
@@ -0,0 +1,5 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f sleep/sleep-with-hostPath-subPath.yaml
|
||||
kubectl exec deploy/sleep -- sh -c 'ls /pod-logs | grep _pi-'
|
||||
kubectl exec deploy/sleep -- sh -c 'ls /container-logs | grep nginx'
|
||||
@@ -0,0 +1,6 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl label node $(kubectl get nodes -o jsonpath='{.items[0].metadata.name}') kiamol=ch05
|
||||
kubectl get nodes -l kiamol=ch05
|
||||
kubectl apply -f todo-list/persistentVolume.yaml
|
||||
kubectl get pv
|
||||
@@ -0,0 +1,5 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f todo-list/postgres-persistentVolumeClaim.yaml
|
||||
kubectl get pvc
|
||||
kubectl get pv
|
||||
@@ -0,0 +1,4 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f todo-list/postgres-persistentVolumeClaim-too-big.yaml
|
||||
kubectl get pvc
|
||||
@@ -0,0 +1,5 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f sleep/sleep-with-hostPath.yaml
|
||||
kubectl wait --for=condition=Ready pod -l app=sleep
|
||||
kubectl exec deploy/sleep -- mkdir -p /node-root/volumes/pv01
|
||||
@@ -0,0 +1,6 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f todo-list/postgres/
|
||||
sleep 30
|
||||
kubectl logs -l app=todo-db --tail 1
|
||||
kubectl exec deploy/sleep -- sh -c 'ls -l /node-root/volumes/pv01 | grep wal'
|
||||
10
learn/learn-kubernetes-master/kiamol/ch05/exercises/5.13.sh
Normal file
10
learn/learn-kubernetes-master/kiamol/ch05/exercises/5.13.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f todo-list/web/
|
||||
kubectl wait --for=condition=Ready pod -l app=todo-web
|
||||
kubectl get svc todo-web -o jsonpath='http://{.status.loadBalancer.ingress[0].*}:8081/new'
|
||||
|
||||
#
|
||||
|
||||
kubectl delete pod -l app=todo-db
|
||||
kubectl exec deploy/sleep -- ls -l /node-root/volumes/pv01/pg_wal
|
||||
@@ -0,0 +1,7 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f todo-list/postgres-persistentVolumeClaim-dynamic.yaml
|
||||
kubectl get pvc
|
||||
kubectl get pv
|
||||
kubectl delete pvc postgres-pvc-dynamic
|
||||
kubectl get pv
|
||||
@@ -0,0 +1,5 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl get storageclass
|
||||
chmod +x cloneDefaultStorageClass.sh ./cloneDefaultStorageClass.sh
|
||||
kubectl get sc
|
||||
@@ -0,0 +1,7 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl apply -f storageClass/postgres-persistentVolumeClaim-storageClass.yaml
|
||||
kubectl apply -f storageClass/todo-db.yaml
|
||||
kubectl get pvc
|
||||
kubectl get pv
|
||||
kubectl get pods -l app=todo-db
|
||||
@@ -0,0 +1,9 @@
|
||||
# Exercises
|
||||
|
||||
These are scripted versions of the exercises in the chapter.
|
||||
|
||||
I used them to smoke-test the exercises on different clusters.
|
||||
|
||||
You can use them to save typing time, but be aware that it can take a few seconds for the results of the Kubernetes commands to take effect.
|
||||
|
||||
So the output won't always be the same as if you manually run the exercises.
|
||||
@@ -0,0 +1,4 @@
|
||||
cd /kiamol/ch05
|
||||
|
||||
kubectl delete -f pi/v1 -f sleep/ -f storageClass/ -f todo-list/web -f todo-list/postgres -f todo-list/
|
||||
kubectl delete sc kiamol
|
||||
Reference in New Issue
Block a user