使用dashboard添加一个Nginx应用,同时提供集群外部服务
一、添加一个nginx应用
image.png二、查看监听端口
# curl http://127.0.0.1:8080/api/v1/namespaces/default/services/nginx | jq .spec.ports
[
{
"name": "tcp-8080-80-xcscm",
"protocol": "TCP",
"port": 8080,
"targetPort": 80,
"nodePort": 30039
}
]
从上面可以查看,该服务启用了Node Port,来查看一个哪个进行在监听
# lsof -i:30039
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
kube-prox 9764 root 98u IPv6 3698395 0t0 TCP *:30039 (LISTEN)
# cat /proc/9764/cmdline
/snap/microk8s/687/kube-proxy \
--master=http://127.0.0.1:8080 \
--cluster-cidr=10.152.183.0/24 \
--kubeconfig=/snap/microk8s/687/kubeproxy.config \
--proxy-mode=userspace \
--healthz-bind-address=127.0.0.1
这个有个非常关键的参数,,查看手册
--proxy-mode ProxyMode
Which proxy mode to use: 'userspace' (older) or 'iptables' (faster) or 'ipvs' (experimental). If blank, use the best-available proxy (currently
iptables). If the iptables proxy is selected, regardless of how, but the system's kernel or iptables versions are insufficient,
this always falls back to the userspace proxy.
网友评论