ingress工作流程

https://github.com/kubernetes/ingress-nginx/tree/nginx-0.20.0/deploy

下载这6个文件

第一步先创建namespace.yaml 名称空间,其他的就没啥要求了

kubectl appliy -f .

########################################################################

ingress https自签证书

1,生成证书

[root@k8s-master-29 ssl]# openssl genrsa -out tls.key 2048
Generating RSA private key, 2048 bit long modulus
.................+++
...........+++
e is 65537 (0x10001)
[root@k8s-master-29 ssl]# openssl req -new -x509 -key tls.key -out tls.crt -subj /C=CN/ST=Shenzhen/L=Shenzhen/O=DevOps/CN=educationcrmvue.rpdns.com
[root@k8s-master-29 ssl]# kubectl create secret tls educationcrmvue-ingress-secret --cert=tls.crt --key=tls.key 
secret/educationcrmvue-ingress-secret created

使用阿里云免费证书,申请下载略

kubectl create secret generic mini-mall-admin-secret --from-file=tls.key=./3168390_miniprog.liabio.cn.key --from-file=tls.crt=./3168390_miniprog.liabio.cn.pem


2,查看

[root@k8s-master-29 ssl]# kubectl get secret
NAME                                 TYPE                                  DATA   AGE
default-token-sc72r                  kubernetes.io/service-account-token   3      2d4h
dockerpullauth                       kubernetes.io/dockerconfigjson        1      30h
educationcrmvue-ingress-secret       kubernetes.io/tls                     2      36s
nfs-client-provisioner-token-2xdtn   kubernetes.io/service-account-token   3      33h
[root@k8s-master-29 ssl]# kubectl describe secret educationcrmvue-ingress-secret
Name:         educationcrmvue-ingress-secret
Namespace:    default
Labels:       <none>
Annotations:  <none>

Type:  kubernetes.io/tls

Data
====
tls.crt:  1322 bytes
tls.key:  1675 bytes

3,

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: educationcrmvue
  namespace: default
spec:
  tls:
  - hosts:
    - educationcrmvue.rpdns.com
    secretName: educationcrmvue-ingress-secret
  rules:
  - host: educationcrmvue.rpdns.com
    http:
      paths:
      - path: /
        backend:
          serviceName: educationcrmvue
          servicePort: 80

4,访问

https://educationcrmvue.rpdns.com:30443

Logo

K8S/Kubernetes社区为您提供最前沿的新闻资讯和知识内容

更多推荐