Helm/Keycloak: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
| Line 4: | Line 4: | ||
==Config== | ==Config== | ||
<syntaxhighlight lang=" | {|class='wikitable mw-collapsible' style='width:100%' | ||
!scope='col' style='text-align:left'| | |||
Config | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang="bash"> | |||
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" | export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml" | ||
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml" | export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml" | ||
export KUBECONFIG="${HOME}/.kube/config" | export KUBECONFIG="${HOME}/.kube/config" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |||
==Install== | ==Install== | ||
{| | {|class='wikitable mw-collapsible' style='width:100%' | ||
|colspan= | !scope='col' style='text-align:left' colspan='2'| | ||
<syntaxhighlight lang="sql"> | Install | ||
|- | |||
|valign='top' colspan='2'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang="sql"> | |||
cat << DDL | psql -U ${USER} | cat << DDL | psql -U ${USER} | ||
CREATE DATABASE keycloak; | CREATE DATABASE keycloak; | ||
| Line 20: | Line 29: | ||
DDL | DDL | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
<syntaxhighlight style='margin:3px 0 3px 0' lang="yaml"> | |||
<syntaxhighlight lang="yaml"> | |||
kubectl create namespace keycloak | kubectl create namespace keycloak | ||
cat <<'YML' | \ | cat <<'YML' | \ | ||
| Line 66: | Line 71: | ||
YML | YML | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
|valign='top'| | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang="properties"> | <syntaxhighlight style='margin:3px 0 3px 0' lang="properties"> | ||
xdg-open http://keycloak.k8s.local &>/dev/null & | xdg-open http://keycloak.k8s.local &>/dev/null & | ||
gnome-open http://keycloak.k8s.local &>/dev/null & | gnome-open http://keycloak.k8s.local &>/dev/null & | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|valign='top'| | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang="properties"> | <syntaxhighlight style='margin:3px 0 3px 0' lang="properties"> | ||
x-www-browser http://keycloak.k8s.local &>/dev/null & | x-www-browser http://keycloak.k8s.local &>/dev/null & | ||
sensible-browser http://keycloak.k8s.local &>/dev/null & | sensible-browser http://keycloak.k8s.local &>/dev/null & | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
==Uninstall== | ==Uninstall== | ||
<syntaxhighlight lang= | {|class='wikitable mw-collapsible mw-collapsed' style='width:100%' | ||
!scope='col' style='text-align:left'| | |||
Uninstall | |||
|- | |||
|valign='top'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
helm uninstall -n keycloak keycloak | helm uninstall -n keycloak keycloak | ||
kubectl delete namespace keycloak | kubectl delete namespace keycloak | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |||
==Playground== | ==Playground== | ||
{| | {|class='wikitable mw-collapsible' style='width:100%' | ||
| colspan= | !scope='col' style='text-align:left' colspan='2'| | ||
<syntaxhighlight lang= | Playground | ||
|- | |||
|valign='top' colspan='2'| | |||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
helm -n keycloak install keycloak bitnami/keycloak --version 19.3.3 | helm -n keycloak install keycloak bitnami/keycloak --version 19.3.3 | ||
helm -n keycloak upgrade -i keycloak bitnami/keycloak --version 22.0.0 | helm -n keycloak upgrade -i keycloak bitnami/keycloak --version 22.0.0 | ||
helm show values bitnami/keycloak --version 19.3.3|less | helm show values bitnami/keycloak --version 19.3.3|less | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
<syntaxhighlight lang= | |||
kubectl -n keycloak exec -it svc/keycloak -c keycloak -- /opt/bitnami/keycloak/bin/kc.sh --version | kubectl -n keycloak exec -it svc/keycloak -c keycloak -- /opt/bitnami/keycloak/bin/kc.sh --version | ||
kubectl -n keycloak exec -it svc/keycloak -c keycloak -- cat /opt/bitnami/keycloak/version.txt | kubectl -n keycloak exec -it svc/keycloak -c keycloak -- cat /opt/bitnami/keycloak/version.txt | ||
| Line 111: | Line 116: | ||
|- | |- | ||
| | |valign='top' colspan='2'| | ||
<syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | |||
<syntaxhighlight lang= | |||
ADMIN_PASS=$(kubectl -n keycloak get secret keycloak -o json|jq -r '.data."admin-password"'|base64 -d) | ADMIN_PASS=$(kubectl -n keycloak get secret keycloak -o json|jq -r '.data."admin-password"'|base64 -d) | ||
ADMIN_PASS=$(kubectl -n keycloak get secret keycloak -o jsonpath="{.data.admin-password}"|base64 -d) | ADMIN_PASS=$(kubectl -n keycloak get secret keycloak -o jsonpath="{.data.admin-password}"|base64 -d) | ||
| Line 125: | Line 127: | ||
kubectl -n keycloak exec -it keycloak-postgresql-0 -- bash | kubectl -n keycloak exec -it keycloak-postgresql-0 -- bash | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| colspan= | |valign='top' colspan='2'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten | kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten | ||
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten | kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten | ||
| Line 137: | Line 135: | ||
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten | kubectl config --kubeconfig=${HOME}/.kube/config view --flatten | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl -n keycloak delete all --all | kubectl -n keycloak delete all --all | ||
kubectl -n keycloak delete ing --all | kubectl -n keycloak delete ing --all | ||
| Line 149: | Line 143: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| valign= | |valign='top' style='width:50%'| | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl -n keycloak delete svc --all | kubectl -n keycloak delete svc --all | ||
kubectl -n keycloak delete pvc --all | kubectl -n keycloak delete pvc --all | ||
kubectl -n keycloak delete pv --all | kubectl -n keycloak delete pv --all | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl -n keycloak rollout history sts keycloak | kubectl -n keycloak rollout history sts keycloak | ||
kubectl -n keycloak rollout restart sts keycloak | kubectl -n keycloak rollout restart sts keycloak | ||
| Line 168: | Line 158: | ||
| valign="top" | | | valign="top" | | ||
<syntaxhighlight lang= | <syntaxhighlight style='margin:3px 0 3px 0' lang='bash'> | ||
kubectl -n keycloak exec -it keycloak-postgresql-0 -- psql -Ukeycloak | kubectl -n keycloak exec -it keycloak-postgresql-0 -- psql -Ukeycloak | ||
kubectl -n keycloak logs -f keycloak-postgresql-0 | kubectl -n keycloak logs -f keycloak-postgresql-0 | ||
kubectl -n keycloak logs -f keycloak-0 | kubectl -n keycloak logs -f keycloak-0 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
==References== | ==References== | ||
{| | {|class='wikitable mw-collapsible' style='width:100%' | ||
| valign= | !scope='col' style='text-align:left' colspan='3'| | ||
References | |||
|- | |||
|valign='top' style='width:34%'| | |||
* [https://stackoverflow.com/questions/75596795/ Helm » Pass YAML/JSON using <code>stdin</code>] | * [https://stackoverflow.com/questions/75596795/ Helm » Pass YAML/JSON using <code>stdin</code>] | ||
* [[Helm/Prometheus Stack|Helm » Prometheus Stack]] | * [[Helm/Prometheus Stack|Helm » Prometheus Stack]] | ||
| Line 185: | Line 177: | ||
* [[Helm]] | * [[Helm]] | ||
| valign= | |valign='top' style='width:33%'| | ||
| valign= | |valign='top' style='width:33%'| | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
| Line 205: | Line 194: | ||
| valign="top" | | | valign="top" | | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
Revision as of 12:31, 11 December 2025
helm repo add bitnami https://charts.bitnami.com/bitnami helm repo update && helm repo list kubectl config get-contexts
Config
|
Config |
|---|
export KUBECONFIG="${HOME}/.kube/dev-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/gcp-kubeconfig.yaml"
export KUBECONFIG="${HOME}/.kube/config"
|
Install
|
Install | |
|---|---|
cat << DDL | psql -U ${USER}
CREATE DATABASE keycloak;
CREATE USER keycloak WITH ENCRYPTED PASSWORD 'sadaqah!';
GRANT ALL PRIVILEGES ON DATABASE keycloak TO keycloak;
DDL
| |
kubectl create namespace keycloak
cat <<'YML' | \
helm -n keycloak upgrade --install keycloak bitnami/keycloak --version 19.3.3 -f -
---
auth:
adminUser: admin
adminPassword: "sadaqah!"
ingress:
enabled: true
ingressClassName: nginx
hostname: keycloak.k8s.ops
tls:
enabled: false
# extraEnvVars:
# - name: KC_HOSTNAME
# value: https://keycloak.k8s.ops
image:
registry: docker.io
repository: bitnamilegacy/keycloak
tag: 23.0.7-debian-12-r3
postgresql:
enabled: true
architecture: standalone
image:
registry: docker.io
repository: bitnamilegacy/postgresql
tag: 16.2.0-debian-12-r8
auth:
username: keycloak
password: "sadaqah!"
database: keycloak
postgresPassword: "sadaqah!"
YML
| |
xdg-open http://keycloak.k8s.local &>/dev/null &
gnome-open http://keycloak.k8s.local &>/dev/null &
|
x-www-browser http://keycloak.k8s.local &>/dev/null &
sensible-browser http://keycloak.k8s.local &>/dev/null &
|
Uninstall
|
Uninstall |
|---|
helm uninstall -n keycloak keycloak
kubectl delete namespace keycloak
|
Playground
|
Playground | |
|---|---|
helm -n keycloak install keycloak bitnami/keycloak --version 19.3.3
helm -n keycloak upgrade -i keycloak bitnami/keycloak --version 22.0.0
helm show values bitnami/keycloak --version 19.3.3|less
| |
kubectl -n keycloak exec -it svc/keycloak -c keycloak -- /opt/bitnami/keycloak/bin/kc.sh --version
kubectl -n keycloak exec -it svc/keycloak -c keycloak -- cat /opt/bitnami/keycloak/version.txt
| |
ADMIN_PASS=$(kubectl -n keycloak get secret keycloak -o json|jq -r '.data."admin-password"'|base64 -d)
ADMIN_PASS=$(kubectl -n keycloak get secret keycloak -o jsonpath="{.data.admin-password}"|base64 -d)
kubectl -n keycloak exec -it svc/keycloak-postgresql -c postgresql -- psql -Ukeycloak
kubectl -n keycloak exec -it svc/keycloak-postgresql -c postgresql -- bash
kubectl -n keycloak exec -it svc/keycloak -c keycloak -- ls -lah /var
kubectl -n keycloak exec -it svc/keycloak -c keycloak -- bash
kubectl -n keycloak exec -it keycloak-postgresql-0 -- bash
| |
kubectl config --kubeconfig=${HOME}/.kube/aws-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/dev-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/gcp-kubeconfig.yaml view --flatten
kubectl config --kubeconfig=${HOME}/.kube/config view --flatten
| |
kubectl -n keycloak delete all --all
kubectl -n keycloak delete ing --all
kubectl -n keycloak delete sts --all
|
kubectl -n keycloak delete svc --all
kubectl -n keycloak delete pvc --all
kubectl -n keycloak delete pv --all
|
kubectl -n keycloak rollout history sts keycloak
kubectl -n keycloak rollout restart sts keycloak
kubectl -n keycloak rollout status sts keycloak
|
kubectl -n keycloak exec -it keycloak-postgresql-0 -- psql -Ukeycloak
kubectl -n keycloak logs -f keycloak-postgresql-0
kubectl -n keycloak logs -f keycloak-0
|
References
|
References | ||
|---|---|---|