added Don früh
This commit is contained in:
44
k8s/install_nginx
Normal file
44
k8s/install_nginx
Normal file
@@ -0,0 +1,44 @@
|
||||
cd ~
|
||||
mkdir nginx && cd nginx
|
||||
|
||||
# namespace
|
||||
kubectl create namespace nginx
|
||||
kubectl config set-context --current --namespace nginx
|
||||
|
||||
# create pod and service nginx
|
||||
kubectl run nginx --image nginx --labels run=nginx --dry-run=client -o yaml >nginx.yaml
|
||||
kubectl apply -f nginx.yaml
|
||||
|
||||
kubectl expose pod nginx -o yaml --port 80 --target-port 80 --dry-run=client >nginx-svc.yaml
|
||||
kubectl apply -f nginx-svc.yaml
|
||||
|
||||
# access service
|
||||
kubectl run curl --tty -i --image curlimages/curl -- /bin/sh
|
||||
curl -i http://nginx
|
||||
exit
|
||||
|
||||
# start new pod for nginx service ... same labels
|
||||
kubectl run nginx1 --image nginx --labels run=nginx --dry-run=client -o yaml >nginx1.yaml
|
||||
kubectl apply -f nginx1.yaml
|
||||
|
||||
# describe manifest
|
||||
kubectl describe pods nginx
|
||||
kubectl describe svc nginx
|
||||
|
||||
# deploy pod with nginx 1.19.7
|
||||
kubectl set image po nginx nginx=nginx:1.19.7
|
||||
kubectl set image po nginx1 nginx1=nginx:1.19.7
|
||||
|
||||
#or
|
||||
kubectl set image po *=nginx:1.19.8 -l run=nginx
|
||||
|
||||
kubectl describe pods nginx
|
||||
kubectl describe pods nginx1
|
||||
kubectl describe svc nginx
|
||||
kubectl get pods
|
||||
kubectl get ep
|
||||
kubectl get svc
|
||||
kubectl attach curl --tty -i
|
||||
curl http://nginx
|
||||
exit
|
||||
kubectl attach -ti curl
|
||||
Reference in New Issue
Block a user