1. 环境查看
    系统环境
# cat /etc/redhat-release 
Rocky Linux release 9.3 (Blue Onyx)
# uname -a
Linux Rocky9K8SMaster003021 5.14.0-362.18.1.el9_3.0.1.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Feb 11 13:49:23 UTC 2024 x86_64 x86_64 x86_64 GNU/L
  • 1.
  • 2.
  • 3.
  • 4.

软件环境

Rancher怎么安装Ingress_Pod

  1. 安装Ingress
    如果在第一次创建集群则在高级选项选择启用Ingress

    如果第一次创建时没有安装Ingress则编辑集群选择即可

    选择之后集群自动更新
    查看Ingress创建的Pod
# kubectl get pod -n ingress-nginx
NAME                                   READY   STATUS      RESTARTS   AGE
nginx-ingress-controller-lkcqv         1/1     Running     0          110m
nginx-ingress-controller-mflkd         1/1     Running     0          109m
  • 1.
  • 2.
  • 3.
  • 4.

默认创建在每个节点都会创建一个Pod

设置在其中的两个节点创建

添加节点标签

编辑节点配置

Rancher怎么安装Ingress_Pod_02


添加一个标签使用该标签让Pod部署到该节点

Rancher怎么安装Ingress_Deployment_03


添加一个污点让其他Pod不部署到该节点

Rancher怎么安装Ingress_Pod_04


本次设置两个节点作为Ingress的节点

编辑Ingress配置

Rancher怎么安装Ingress_Pod_05


Rancher怎么安装Ingress_nginx_06


设置完成以后只会把Ingress部署到对应的两个节点

Rancher怎么安装Ingress_nginx_07

  1. 创建Deployment和Service
  2. 创建Deployment和Service测试Ingress
  3. Rancher怎么安装Ingress_nginx_08


  4. Rancher怎么安装Ingress_Deployment_09


  5. Rancher怎么安装Ingress_Deployment_10


  6. 查看创建好的service
  7. Rancher怎么安装Ingress_Deployment_11

  8. 创建Ingress
    创建Ingress

Rancher怎么安装Ingress_Pod_12


Rancher怎么安装Ingress_nginx_13


设置该Ingress对应的后端service即上一步设置的service名

Rancher怎么安装Ingress_Deployment_14


访问测试

需设置hosts或者是设置了公网域名映射

Rancher怎么安装Ingress_nginx_15


如果是https则先添加证书至sercert

Rancher怎么安装Ingress_nginx_16


Rancher怎么安装Ingress_Pod_17