Skip to content

Instantly share code, notes, and snippets.

@pahofmann
Created May 28, 2020 13:23
Show Gist options
  • Select an option

  • Save pahofmann/dea2c3dd6c3bb2248ef00292f3073d8a to your computer and use it in GitHub Desktop.

Select an option

Save pahofmann/dea2c3dd6c3bb2248ef00292f3073d8a to your computer and use it in GitHub Desktop.
Expose and secure Keptn Bridge via nginx ingress

Create basic auth credentials

$ htpasswd -c auth UserName
New password: <Password>
Re-type new password:
Adding password for user UserName

Create secret

$ kubectl create secret generic bridge-basic-auth --from-file=auth
secret "bridge-basic-auth" created

Create Ingress

Create a new ingress file (bridge-ingress.yaml):

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: bridge-ingress
  namespace: keptn
  annotations:
    kubernetes.io/ingress.class: nginx
    cert-manager.io/cluster-issuer: <clusterIssuerName>
    nginx.ingress.kubernetes.io/auth-type: basic
    nginx.ingress.kubernetes.io/auth-secret: bridge-basic-auth
    nginx.ingress.kubernetes.io/auth-realm: 'Access only for ture keptns!'
spec:
  tls:
    - hosts:
      - bridge.keptn.your.domain
      secretName: <CertificateSecretName>
  rules:
    - host: bridge.keptn.your.domain
      http:
        paths:
          - backend:
              serviceName: bridge
              servicePort: 8080
$ kubectl apply -f bridge-ingress.yaml
ingress "bridge-ingress" created
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment