Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 882 Bytes

1.simple-pod.MD

File metadata and controls

38 lines (28 loc) · 882 Bytes

Simple pod demo

Run nginx as webserver

# We can create deployment by 'run' option before k8s v1.18
$ kubectl run --image=nginx nginx
$ kubectl run --image=nginx nginx --restart='Always'
# We should create deployment by 'create deployment' option after k8s v1.18
$ kubectl create deployment nginx --image=nginx --port=80

Show running pod

$ kubectl get po --show-labels -owide -w

Expose svc

# When we create deployment by 'run' option, we use selector 'run=nginx'
$ kubectl expose deploy nginx --selector run=nginx --port=80 --type=NodePort
# When we create deployment by 'create deployment' option, we use selector 'app=nginx'
$ kubectl expose deploy nginx --selector app=nginx --port=80 --type=NodePort

Check svc detail

$ kubectl get svc

Access service

$ curl 192.168.34.2:<nodeport>