deployment.yaml 2.13 KB
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: istio-gateway-certs
spec:
  secretName: istio-gateway-certs
  dnsNames:
  - '*'
  issuerRef:
    name: ca-issuer
    # We can reference ClusterIssuers by changing the kind here.
    # The default value is Issuer (i.e. a locally namespaced Issuer)
    kind: ClusterIssuer
    group: cert-manager.io
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  name: istio-gateway
spec:
  selector:
    istio: istio-gateway
  servers:
  - hosts:
    - '*'
    port:
      name: http
      number: 80
      protocol: HTTP
  - hosts:
    - '*'
    port:
      name: https
      number: 443
      protocol: HTTPS
    tls:
      credentialName: istio-gateway-certs
      mode: SIMPLE
---
apiVersion: v1
kind: Service
metadata:
  name: istio-gateway
spec:
  type: LoadBalancer
  selector:
    istio: istio-gateway
  ports:
		- port: 80
			name: http
		- port: 443
			name: https
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: istio-gateway
spec:
  selector:
    matchLabels:
      istio: istio-gateway
  template:
    metadata:
      annotations:
        # Select the gateway injection template (rather than the default sidecar template)
        inject.istio.io/templates: gateway
      labels:
        # Set a unique label for the gateway. This is required to ensure Gateways can select this workload
        istio: istio-gateway
        # Enable gateway injection. If connecting to a revisioned control plane, replace with "istio.io/rev: revision-name"
        sidecar.istio.io/inject: "true"
    spec:
      containers:
				- name: istio-proxy
					image: auto # The image will automatically update each time the pod starts.
---
# Set up roles to allow reading credentials for TLS
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: istio-gateway-sds
rules:
	- apiGroups: [""]
		resources: ["secrets"]
		verbs: ["get", "watch", "list"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: istio-gateway-sds
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: istio-gateway-sds
subjects:
	- kind: ServiceAccount
		name: default
---