44 lines
1.1 KiB
Plaintext
44 lines
1.1 KiB
Plaintext
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 |