安装openssl
Win32/Win64 OpenSSL Installer for Windows - Shining Light Productions
生成证书
- openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout example.local.key -out example.local.crt -subj "/CN=example.local/O=example.local"
复制代码 创建K8S secret
kubectl create secret tls example-local-tls --key example.local.key --cert example.local.crt
检察
kubectl get secret example-local-tls -o yaml
创建SSL转发
nginx-ingress.yaml
- apiVersion: networking.k8s.io/v1
- kind: Ingress
- metadata:
- name: nginx-ingress
- annotations:
- nginx.ingress.kubernetes.io/rewrite-target: /
- spec:
- ingressClassName: nginx
- rules:
- - host: example.local
- http:
- paths:
- - path: /
- pathType: Prefix
- backend:
- service:
- name: nginx-service
- port:
- number: 80
- tls:
- - hosts:
- - example.local
- secretName: example-local-tls
复制代码 kubectl apply -f nginx-ingress.yaml
访问
https://example.local/
检察ingress转发日记
kubectl get pods -n ingress-nginx
kubectl logs -n ingress-nginx ingress-nginx-controller-5b5f8c9f5d-abcdef
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |