企业运维实战--k8s学习笔记6.Ingress加密、认证以及地址重写
一、Ingress 加密
生成加密密钥
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout tls.key -out tls.crt -subj "/CN=nginxsvc/O=nginxsvc"
创建secrets对应密钥
kubectl create secret tls tls-secret --key tls.key --cert tls.crt
kubectl get secrets
编辑ingress文件
vim ingress.yaml
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ingress-nginx
spec:
tls:
- hosts:
- www1.westos.org
secretName: tls-secret
rules:
- host: www1.westos.org
http:
paths:
- path: /
backend:
serviceName: nginx-svc