简体   繁体   中英

i can't access service via k8s master node

I'm learning k8s & nodePort

  1. made 1 master node & 1 worker node at AWS EC2
  2. installed k8s, kubeadm
  3. Use flannel CNI
  4. deployed a nodejs app. with port 3000
  5. Attach a nodePort to nodejs app. so, 3000:31000
  6. I expected that i access to that nodejs app outside ec2 with url: "[master-node-pub-ip]:31000"
  7. But i can't access to "[master-node-pub-ip]:31000" and can access with "[worker-node-pub-ip]:31000"

I don't know what did i wrong...

How can i access that nodejs app via master nodes ip??

Thank you.

Try to install an ingress controller

I prefer the helm way:

helm repo add nginx-stable https://helm.nginx.com/stable
helm repo update
helm install nginx-ingress nginx-stable/nginx-ingress --set rbac.create=true

Then you can access to you nodepert via the node public IP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM