Ingress to apps secured by Azure AD (Microsoft Entra ID) in Kubernetes
To use the ngrok Kubernetes Operator with Azure AD (Microsoft Entra ID):
The ngrok Kubernetes Operator is ngrok's official controller for adding secure public ingress and middleware execution to your Kubernetes apps with ngrok's Cloud Edge. With ngrok, you can manage and secure traffic to your apps at every stage of the development lifecycle while also benefitting from simpler configurations, security, and edge acceleration.
Microsoft Azure Active Directory (AD)—now known as Microsoft Entra ID (see the tip below)—is an identity and access management platform that helps administrators and DevOps engineers safeguard their organization's multicloud environment with strong authentication and unified identity management, whether they operate in Azure cloud or on-premises.
In October 2023, Microsoft Azure Active Directory (AD) was renamed Microsoft Entra ID to "communicate the multicloud, multiplatform functionality" and "alleviate confusion with Windows Server Active Directory." This name change changes nothing about the product or its capabilities. We have used Azure AD up to this point due to the recency of the change, but will use Entra ID for the remainder.
The ngrok Kubernetes Operator and Entra ID integrate by letting you not only route public traffic to an app deployed on a Kubernetes cluster, but also restrict access only to users who you have authorized through Entra ID.
With this guide, you'll (optionally) create a new Kubernetes cluster and example deployment and install the ngrok Kubernetes Operator to securely route traffic through the ngrok Cloud Edge. You'll then use the ngrok dashboard to enable Security Assertion Markup Language (SAML), using Entra ID as your identity provider, to authorize specific users with a single sign-on experience.
- An ngrok account at the pay-as-you-go or custom tiers.
- A Microsoft Azure account with access to an existing Entra ID tenant or the ability to create a new tenant with an Entra ID P1 or P2 license.
- A Kubernetes cluster, either locally or in a public cloud, with an app you'd like to be publicly accessible to specific users.
Step 1: Create a cluster and deploy an example app
This guide requires you to deploy some app on any Kubernetes cluster, either locally or in a public cloud, to provide an endpoint for ngrok's secure tunnel. You can use any cluster and any app, but for demonstration, we'll create a local Kubernetes cluster with minikube and deploy the Online Boutique example.
If you already have a cluster and app, skip to Step 2: Add the ngrok Kubernetes Operator.
-
Download the
GoogleCloudPlatform/microservices-demo
project to your local workstation and navigate into the new directory.Loading…
-
Create a new minikube cluster.
Loading…
-
Apply the manifests for the Online Boutique.
Loading…
Step 2: Add the ngrok Kubernetes Operator
Next, you'll configure and deploy the ngrok Kubernetes Operator to expose your app to the public internet through the ngrok Cloud Edge.
-
Add the ngrok Helm repository if you haven't already.
Loading…
-
Create a ngrok static subdomain for ingress if you don't have one already. Navigate to the Domains section of the ngrok dashboard and click Create Domain or New Domain. This static subdomain will be your
NGROK_DOMAIN
for the remainder of this guide.Creating a subdomain on the ngrok network provides a public route to accept HTTP, HTTPS, and TLS traffic.
-
Set up the
AUTHTOKEN
andAPI_KEY
exports, which allows Helm to install the Operator using your ngrok credentials. Find yourAUTHTOKEN
under Your Authtoken in the ngrok dashboard.To create a new API key, navigate to the API section of the ngrok dashboard, click the New API Key button, change the description or owner, and click the Add API Key button. Copy the API key token shown in the modal window before closing it, as the ngrok dashboard will not show you the token again.
Loading…
-
Install the ngrok Kubernetes Operator with Helm.
Loading…
-
Verify the health of your new Operator pod.
Loading…
-
Create a new
boutique-ingress.yml
file, which defines how the ngrok Kubernetes Operator should route traffic on yourNGROK_DOMAIN
to your Online Boutique app.tipMake sure you edit line
9
of the manifest below, which contains theNGROK_DOMAIN
variable, with the ngrok subdomain you already created. It should look something likeone-two-three.ngrok.app
.If you are adding the ngrok Kubernetes Operator to a different deployment, you will need also change the
metadata.name
,service.name
, andservice.port.number
values to match your app's configuration. See the controller docs for additional details onspec
settings and common overrides.Loading…
-
Apply the
boutique-ingress.yaml
manifest you just created.Loading…
Give your cluster a few moments to launch the necessary resources and for ngrok's Cloud Edge to pick up the new tunnel.
tipIf you see an error when applying the manifest, double-check that you've updated the
NGROK_DOMAIN
value and re-apply. -
Access your app, with ingress now handled by ngrok, by navigating to your ngrok domain, e.g.
https://one-two-three.ngrok.app
, in your browser.