ingress https添加证书

创建 secret命令

$kubectl -n create secret tls --key ./tls.key --cert ./tls.crt

示例:

## 创建
root@ubuntu-server:/# kubectl -n jzsz create secret tls app-jzsz-com-secret --key ./tls.key --cert ./tls.crt
##查看
kubectl get secret -n jzsz

NAME                  TYPE                                  DATA   AGE
app-jzsz-com-secret   kubernetes.io/tls                     2      4m35s
default-token-fgjch   kubernetes.io/service-account-token   3      33d



##yaml脚本
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: https-mp
  namespace: jzsz
  annotations:
    nginx.ingress.kubernetes.io/app-root: /jzsz-mp-web
spec:
  tls:
    - hosts:
      - mp.ivops.net
      secretName: app-jzsz-com-secret
  rules:
  - host: mp.ivops.net
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: jzsz-mp-web
            port:
              number: 7716

你可能感兴趣的:(ingress https添加证书)