使用ingress的问题

来源:6-7 实战Ingress控制器

rubbish_hama

2022-12-21

  1. 按照课程,在ingress-nginx-controller.yaml 中写死的10.1.211.240的IP
  2. 执行:kc apply -f ingress-nginx-controller.yaml --validate=false,所有服务节点都正常启动
  3. 执行:kc create -f ingress-nginx.yaml
  4. 执行:kc get ing 可以看到 ADDRES 中出现 10.1.211.240
  5. /etc/hosts 配置 10.1.211.240 hello-world.info
  6. 但是执行:curl hello-world.info:80,报错 拒绝连接
  7. 修改 ingress-nginx-controller.yaml 中的10.1.211.240,改为本机IP,报错 provided IP is not in the valid range. The range of valid IPs is 10.1.0.0/16

两个问题:
8. clusterIP: 10.1.211.240 这个配置是做什么用的,一定要用这个IP吗
9. 本机执行 curl hello-world.info:80,报错 拒绝连接 的原因

写回答

1回答

清风

2022-12-25

你把资源都清理一下,执行这两个:

kubectl apply -f 6-6-example-ingress.yaml

kc apply -f 6-6-ingress-nginx-controller.yaml

再执行curl hello-world.info:80即可。


Service 通过 Cluster 内部的 IP 对外提供服务,只有 Cluster 内的节点和 Pod 可访问,这是默认的 Service 类型.

10.1.211.240是flannel为service分配的默认ip,你以实际的ip为准。

参考官网 https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

0
0

Kubernetes 入门到进阶实战,系统性掌握 K8s 生产实践

阿里云最有价值专家亲授,云原生时代必备技能

1502 学习 · 613 问题

查看课程