我在Kubernetes集群上访问NodePort服务时遇到困难.
目标
设置ALB Ingress控制器,以便我可以使用websockets和http/2
根据该控制器的要求设置NodePort服务
采取的步骤
以前在AWS eu-west-1上创建了Kops(版本1.6.2)集群.添加了nginx入口的kops插件以及Kube-lego.ELB入口工作正常.
使用该项目指定的IAM配置文件,使用自定义AWS密钥设置ALB Ingress Controller.
使用kubectl replace --force将服务类型从LoadBalancer更改为NodePort
> kubectl describe svc my-nodeport-service
Name: my-node-port-service
Namespace: default
Labels: <none>
Selector: service=my-selector
Type: NodePort
IP: 100.71.211.249
Port: <unset> 80/TCP
NodePort: <unset> 30176/TCP
Endpoints: 100.96.2.11:3000
Session Affinity: None
Events: <none>
> kubectl describe pods my-nodeport-pod
Name: my-nodeport-pod
Node: <ip>.eu-west-1.compute.internal/<ip>
Labels: service=my-selector
Status: Running
IP: 100.96.2.11
Containers:
update-center:
Port: 3000/TCP
Ready: True
Restart Count: 0
(ssh into node)
$ sudo netstat -nap | grep 30176
tcp6 0 …Run Code Online (Sandbox Code Playgroud)