kubernetes ingress 配置证书

以 a.jansora.com 为例

1. 申请证书

走阿里云申请, 申请地址点 这里

拷贝到指定目录

root@l2:/etc/nginx/certs/a.jansora.com# ls -l
total 8
-rw-r--r-- 1 root root 1675 Nov  1 15:54 a.jansora.com.key
-rw-r--r-- 1 root root 3850 Nov  1 15:54 a.jansora.com.pem

创建证书密钥

kubectl create secret tls a.jansora.com --key /etc/nginx/certs/a.jansora.com/a.jansora.com.key --cert /etc/nginx/certs/a.jansora.com/a.jansora.com.pem

配置 ingress

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: a-ingress
  annotations:

spec:
  ingressClassName: nginx
  tls:
    - hosts:
      - 'a.jansora.com'
      secretName: a.jansora.com
  rules:
    - host:a.jansora.com
      http:
        paths:
          - backend:
              service:
                name: a-service
                port:
                  number: 443
            pathType: Prefix
            path: /

评论栏