请选择 进入手机版 | 继续访问电脑版
MSIPO技术圈 首页 IT技术 查看内容

k8s Ingress(traefik)修改域名

2023-07-13

查看 ingress

kubectl get ingress

输出

NAME                     CLASS    HOSTS                                               ADDRESS        PORTS     AGE
rc1                    <none>   rc1.fox.com                                             192.168.10.2   80        452d

修改 ingress 域名

 kubectl edit ingress rc1

把 显示 的 host: rc1.fox.com 修改为你想要修改的域名例如 host: rc1.foxwho.com

实际结果(修改后的)

# Please edit the object below. Lines beginning with a '#' will be ignored,                                                                                                                                             
# and an empty file will abort the edit. If an error occurs while saving this file will be                                                                                                                              
# reopened with the relevant failures.                                                                                                                                                                                  
#                                                                                                                                                                                                                       
apiVersion: networking.k8s.io/v1                                                                                                                                                                                        
kind: Ingress                                                                                                                                                                                                           
metadata:                                                                                                                                                                                                               
  annotations:                                                                                                                                                                                                          
    kubernetes.io/ingress.class: traefik                                                                                                                                                                                
  creationTimestamp: "2022-04-13T10:15:52Z"                                                                                                                                                                             
  generation: 1                                                                                                                                                                                                         
  name: rc1-saas                                                                                                                                                                                                        
  namespace: default                                                                                                                                                                                                    
  resourceVersion: "11089342"                                                                                                                                                                                           
  uid: 054d140d-7d10-4256-be4f-e6af17746d66                                                                                                                                                                             
spec:                                                                                                                                                                                                                   
  rules:                                                                                                                                                                                                                
  - host: rc1.foxwho.com                                                                                                                                                                                           
    http:                                                                                                                                                                                                               
      paths:                                                                                                                                                                                                            
      - backend:                                                                                                                                                                                                        
          service:                                                                                                                                                                                                      
            name: rc1                                                                                                                                                                                              
            port:                                                                                                                                                                                                       
              number: 80                                                                                                                                                                                                
        path: /                                                                                                                                                                                                         
        pathType: ImplementationSpecific                                                                                                                                                                                
status:                                                                                                                                                                                                                 
  loadBalancer:                                                                                                                                                                                                         
    ingress:                                                                                                                                                                                                            
    - ip: 192.168.10.2                                                                                                                                                                                                  
~                             

最后 保存
按esc 键
输入 如下 保存

:wq

相关阅读

热门文章

    手机版|MSIPO技术圈 皖ICP备19022944号-2

    Copyright © 2024, msipo.com

    返回顶部