This guide provides step-by-step instructions for installing Keycloak on a Minikube cluster. Keycloak is an open-source Identity and Access Management (IAM) solution that can be easily integrated into Kubernetes environments.
-
Minikube installed
-
kubectl installed
-
Start Minikube Ensure that Minikube is running with the required resources. Run the following command to start Minikube
-
To check if you have the Ingress addon enabled, enter the following command:
minikube addons list
- If the Ingress addon is not enabled, enter the following command to enable it:
minikube addons enable ingress
- Start Keycloak
The Keycloak QuickStarts repository includes some example files to help deploy Keycloak to Kubernetes.
As a first step, create the Keycloak deployment and service by entering the following command:
kubectl create -f https://raw.githubusercontent.com/keycloak/keycloak-quickstarts/latest/kubernetes/keycloak.yaml
This command starts Keycloak on Kubernetes and creates an initial admin user with the username admin and password admin.
- Access Keycloak with Ingress addon enabled
Now create an Ingress for Keycloak by entering the following command:
sed "s/KEYCLOAK_HOST/keycloak.$(minikube ip).nip.io/" | \
kubectl create -f -
If wget and sed are not available, download the file and manually edit the file replacing KEYCLOAK_HOST with keycloak..nip.io.
- Enter the following command to see the Keycloak URLs:
KEYCLOAK_URL=https://keycloak.$(minikube ip).nip.io &&
echo "" &&
echo "Keycloak: $KEYCLOAK_URL" &&
echo "Keycloak Admin Console: $KEYCLOAK_URL/admin" &&
echo "Keycloak Account Console: $KEYCLOAK_URL/realms/myrealm/account" &&
echo ""
- Access Keycloak without Ingress
If the Ingress addon is not enabled, enter the following command in a separate shell:
minikube tunnel
You can now access Keycloak from the following URL:
KEYCLOAK_URL=http://$(minikube ip):$(kubectl get services/keycloak -o go-template='{{(index .spec.ports 0).nodePort}}') &&
echo "" &&
echo "Keycloak: $KEYCLOAK_URL" &&
echo "Keycloak Admin Console: $KEYCLOAK_URL/admin" &&
echo "Keycloak Account Console: $KEYCLOAK_URL/realms/myrealm/account" &&
echo ""