ingress 模板

######

1.service服务

apiVersion: v1
kind: Service
metadata:
  name: alpha-scalyyrcpage-svc
  namespace: default
spec:
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: 80
  selector:
    app: scareercpage
  sessionAffinity: None
  type: ClusterIP
status:
  loadBalancer: {}

 

2.保密字典

apiVersion: v1
data:
  tls.crt: >-
    LS0tLS1CRUdJTiBDRVJtLS0tCk1JSUd5RENDQmJDZ0F3SUJBZ0lRQXkxV3RHSk9kdFVOU1hONWxZRUtBVEFOQmdrcWhraUc5dzBCQVFzRkFEQmYKTVFlyshjilJJWUVFHRXdKVlV6RVZNQk1HQTFVRUNoTU1SR2xuYVVObGNuUWdTVzVqTVJrd0Z3WURWUVFMRXhCMwpkM2N1WkdsbmFXTmxjblF1WTI5dE1SNHdIQVlEVlFRREV4VkhaVzlVY25WemRDQkRUaUJTVTBFZ1EwRWdSekV3CkhoY05NVGt4TURFMU1EQXdNREF3V2hjTk1qSXdNVEV6TVRJd01EQXdXakNCZ3pFTE1Ba0dBMVVFQmhNQ1EwNHgKRWpBUUJnTlZCQWdNQ2VXTWwrUzZyT1c0Z2pFdE1Dc0dBMVVFQ2d3azVZeVg1THFzNUxpSDVhMm01cFdaNklLeQo1NmVSNW9xQTVweUo2Wm1RNVlXczVZKzRNUnN3R1FZRFZRUUxEQkxrdjZIbWdhL21pb0Rtbksva3VLM2x2NE14CkZEQVNCZ05WQkFNTUN5b3VkMkZ1ZUhWbExtTnVNSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUIKQ2dLQ0FRRUFycldUOWpJMjE1UXphRGtiTSs5VDdKdzlTdHNsTUlZQkF5NzIzdFZEaHkzK1JEMDJKaWFqSTJNOApCL1MxbXZibU82RG9LZ0MybnVwSHlreTNpZXM4cm1QZTJ6dnlIenFzNlhxV05HMzFrbzBlcmZMcVlmbkFmUmY4CklPdFZCOVdMMWhaM0xIMzFNb1Z3akkzYW03VmxBMXFyVmtKUUdKZWZ5V2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d2xaVDVMUUdaZXZaV3RJM2R4ZWVQMTc2VzZZa1p4WGhVd1pka2pqNVZqRVpWNXIwUQo4QWpIZ3lRakVXVk1XR2RyK1kzTWZVYUYvbkN4aVZJazlLcHUxMHZkZU1nR3pqOUM1SmwwSGc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQ==
kind: Secret
metadata:
  creationTimestamp: '2020-04-29T08:38:55Z'
  name: wx-https-secret0
  namespace: default
type: Opaque

3.ingress路由

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/service-weight: ''
  generation: 2
  name: alpha-calyyradmin.tiantian.cn
  namespace: default
spec:
  rules:
    - host: alpha-calyyradmin.tiantian.cn #域名地址
      http:
        paths:
          - backend:
              serviceName: alpha-scalyyrcpage-svc #service名称
              servicePort: 80
            path: /
  tls:
    - hosts:
        - alpha-calyyradmin.tiantian.cn
      secretName: wx-https-secret0
status:
  loadBalancer: {}

######

原文地址:https://www.cnblogs.com/faithH/p/14061769.html