3、https配置
第一步:制作自签证书
[root@master demo]# openssl genrsa -out tls.key 2048
[root@master demo]# openssl req -new -x509 -key tls.key -out tls.crt -subj /C=CN/ST=Guangdong/L=Guangzhou/O=devops/CN=feiutest.cn
生成两个文件:
[root@master demo]# ls
tls.crt tls.key
第二步:创建secret secret介绍
[root@master demo]# kubectl create secret tls nginx-test --cert=tls.crt --key=tls.key
[root@master demo]# kubectl get secret
NAME TYPE DATA AGE
nginx-test kubernetes.io/tls 2 17s
第三步:修改ingress
vi nginx-ingress-yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: test-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: "nginx"
spec:
rules:
- host: feiutest.cn
http:
paths:
- path:
backend:
serviceName: test-ingress
servicePort: 80
tls:
- hosts:
- feiutest.cn
secretName: nginx-test
kubectl apply -f nginx-ingress-yaml
测试访问
https://feiutest.cn:30643