Skip to main content

Service

NodePort#

NodePort๋Š” pod ip:targetPort --- service ip:port --- node ip:nodePort ์—ฐ๊ฒฐ์„ ํ†ตํ•ด ์™ธ๋ถ€์—์„œ pod๋กœ ์ ‘๊ทผ ํ•  ์ˆ˜ ์žˆ๊ฒŒ ๋งŒ๋“ค์–ด์ฃผ๋Š” ์„œ๋น„์Šค ์ž…๋‹ˆ๋‹ค.

$ kubectl describe pods -n kubernetes-dashboard kubernetes-dashboard
...
Labels: k8s-app=kubernetes-dashboard
...
Containers:
kubernetes-dashboard:
...
Port: 8443/TCP
...
kubernetes-dashboard-nodeport.yaml
apiVersion: v1
kind: Service
metadata:
name: kubernetes-dashboard-nodeport
namespace: kubernetes-dashboard
spec:
type: NodePort
ports:
- port: 443
targetPort: 8443
# nordPort: <30000-32767>
selector:
k8s-app: kubernetes-dashboard
kubectl apply -f kubernetes-dashboard-nodeport.yaml
kubectl describe svc -n kubernetes-dashboard kubernetes-dashboard-nodeport
Last updated on