Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

k8s-operator-example

Expose a Kubernetes service to the internet using the ngrok Kubernetes Operator and a standard Kubernetes Ingress.

Prerequisites

Clone and Run

git clone git@github.com:ngrok/k8s-operator-example.git
cd k8s-operator-example

1. Install the ngrok Operator

helm repo add ngrok https://charts.ngrok.com
helm repo update

export NGROK_AUTHTOKEN=<token>
export NGROK_API_KEY=<api-key>

helm install ngrok-operator ngrok/ngrok-operator \
  --namespace ngrok-operator \
  --create-namespace \
  --set credentials.apiKey=$NGROK_API_KEY \
  --set credentials.authtoken=$NGROK_AUTHTOKEN

2. Deploy the example app

kubectl apply -f deployment.yaml

3. Expose it with ngrok

Edit ingress.yaml and replace YOUR_DOMAIN with your reserved domain, then apply:

kubectl apply -f ingress.yaml

Your service is now available at https://YOUR_DOMAIN.

Add to an Existing Service

If you already have a Deployment and Service running in your cluster:

  1. Install the ngrok Operator (one-time setup).

  2. Create an Ingress resource pointing to your service:

    apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: my-app
    spec:
      ingressClassName: ngrok
      rules:
        - host: YOUR_DOMAIN
          http:
            paths:
              - path: /
                pathType: Prefix
                backend:
                  service:
                    name: my-service
                    port:
                      number: 80
  3. Apply it:

    kubectl apply -f ingress.yaml

Your service is now publicly accessible at https://YOUR_DOMAIN.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors