kubectl ——secret

1.申请

每个人在阿里云可以申请10个免费的单站点SSL证书。

用支付宝登录Aliyun就OK了:

https://common-buy.aliyun.com/?spm=5176.15089375.5806769250.1.45e61232sxu1M6&commodityCode=cas#/buy

 

 

申请证书的时候 域名验证方式 【文件验证】

 

验证前,需ops配置好相应 域名 。

验证=》审核=》成功

 

 

根证书下载:右键=》证书安装=》安装到本地计算机的可信根证书下面

Ngubx证书:用以创建 secret in kubernetes

 

2.创建secret

# create secret
kubectl create secret tls ****-tls --key=*****.key  --cert=****.pem  -n $namespace

#查看secret
kubectl get ingress -n $namespace

  

3.创建 || 修改 ingress

# 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: extensions/v1beta1
kind: Ingress
metadata:
  name: *****-ingress
  namespace: *****
spec:
  rules:
  - host: *****.com   #与secret申请的host domain一致
    http:
      paths:
      - backend:
          serviceName: ****
          servicePort: 80
  tls:
  - hosts:
    - *****.com   #与secret申请的host domain一致
    secretName: ******-tls  #与配置的secret name一致

 

# 创建ingress
kubectl create -f ****-ingress-https.yaml -n $namespace

  

4.修改对应configmaps为https对应的网址

 

5.重启pods

 

posted @ 2020-09-07 14:25  PanPan003  阅读(530)  评论(0编辑  收藏  举报