k8s替换业务证书

目录

1.查看所有节点

2.证书准备

3.添加secret

4.调用secret

5.测试


操作概述:

       我这边的证书是放到secret上的...

1.查看所有节点

~]# kubectl get nodes
# 随便进入一个节点
ssh [email protected]

2.证书准备

# 把证书放上去
~]# rz -E

# 解压
~]# unzip xxx.zip
~]# ls
xxx.crt  xxx.pem  xxx.csr  xxx.key

3.添加secret

~]# kubectl delete secret xxx
~]# kubectl create secret tls xxx(名字与之前一样) --cert=/root/xxx.crt --key=/root/xxx.key

4.调用secret

kubectl edit ingress 业务容器名
......  
  spec:
    rules:
    - host: xxx.xxx.com
      http:
        paths:
        - backend:
            serviceName: xxx.xxx.xxx
            servicePort: 80
          path: /
    tls:
    - hosts:
      - xxx.xxx.com
      secretName: secret的名字             ###修改行
  status:
    loadBalancer:
      ingress:
      - {}
kind: List
metadata:
  resourceVersion: ""
  selfLink: ""

5.测试

访问域名按f12

猜你喜欢

转载自blog.csdn.net/kali_yao/article/details/126811539