Keycloak
99 строк · 3.0 Кб
1<#import "/templates/guide.adoc" as tmpl>
2
3<@tmpl.guide
4title="Kubernetes"
5summary="Get started with {project_name} on Kubernetes">
6
7:links-admin-console: {project_name} Admin Console
8:links-account-console: {project_name} Account Console
9
10== Before you start
11
12Make sure you have Minikube installed, ideally with the Ingress addon enabled.
13
14To check if you have the Ingress addon enabled, enter the following command:
15
16[source,bash,subs="attributes+"]
17----
18minikube addons list
19----
20
21If the Ingress addon is not enabled, enter the following command to enable it:
22
23[source,bash,subs="attributes+"]
24----
25minikube addons enable ingress
26----
27
28== Start {project_name}
29
30The {project_name} QuickStarts repository includes some example files to help deploy {project_name} to Kubernetes.
31
32As a first step, create the {project_name} deployment and service by entering the following command:
33
34[source,bash,subs="attributes+"]
35----
36kubectl create -f https://raw.githubusercontent.com/keycloak/keycloak-quickstarts/latest/kubernetes/keycloak.yaml
37----
38
39This command starts {project_name} on Kubernetes and creates an initial admin user with the username `admin` and password
40`admin`.
41
42=== Access {project_name} with Ingress addon enabled
43
44Now create an Ingress for {project_name} by entering the following command:
45
46[source,bash,subs="attributes+"]
47----
48wget -q -O - https://raw.githubusercontent.com/keycloak/keycloak-quickstarts/latest/kubernetes/keycloak-ingress.yaml | \
49sed "s/KEYCLOAK_HOST/keycloak.$(minikube ip).nip.io/" | \
50kubectl create -f -
51----
52
53If `wget` and `sed` are not available, download the file and manually edit the file replacing `KEYCLOAK_HOST`
54with `keycloak.<minikube ip address>.nip.io`.
55
56Enter the following command to see the {project_name} URLs:
57
58[source,bash,subs="attributes+"]
59----
60KEYCLOAK_URL=https://keycloak.$(minikube ip).nip.io &&
61echo "" &&
62echo "{project_name}: $KEYCLOAK_URL" &&
63echo "{project_name} Admin Console: $KEYCLOAK_URL/admin" &&
64echo "{project_name} Account Console: $KEYCLOAK_URL/realms/myrealm/account" &&
65echo ""
66----
67
68=== Access {project_name} without Ingress
69
70If the Ingress addon is not enabled, enter the following command in a separate shell:
71
72[source,bash,subs="attributes+"]
73----
74minikube tunnel
75----
76
77You can now access {project_name} from the following URL:
78
79[source,bash,subs="attributes+"]
80----
81KEYCLOAK_URL=http://$(minikube ip):$(kubectl get services/keycloak -o go-template='{{(index .spec.ports 0).nodePort}}') &&
82echo "" &&
83echo "{project_name}: $KEYCLOAK_URL" &&
84echo "{project_name} Admin Console: $KEYCLOAK_URL/admin" &&
85echo "{project_name} Account Console: $KEYCLOAK_URL/realms/myrealm/account" &&
86echo ""
87----
88
89Remember these URLs. You need them as you follow the instructions in this {section}. The URL for the Account Console does not work yet as you need to create the realm first.
90
91include::templates/realm-config.adoc[]
92
93include::templates/login-to-account.adoc[]
94
95include::templates/first-app.adoc[]
96
97include::templates/next.adoc[]
98
99</@tmpl.guide>
100