-
Notifications
You must be signed in to change notification settings - Fork 36
#267 Deploy Keycloak next to kubernetes #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sahithya23
wants to merge
3
commits into
Greenstand:master
Choose a base branch
from
sahithya23:feature/deploy_keycloak_next
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| # img folder | ||
| img/ | ||
| # Changelog | ||
| CHANGELOG.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| dependencies: | ||
| - name: postgresql | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| version: 16.7.26 | ||
| - name: common | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| version: 2.31.4 | ||
| digest: sha256:d92824e04bd8b3d71ee395ef556c8476badbf15ee7fca655e503933dc90df3eb | ||
| generated: "2025-08-20T12:56:42.787734637Z" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| annotations: | ||
| category: DeveloperTools | ||
| images: | | ||
| - name: keycloak | ||
| image: docker.io/bitnami/keycloak:26.3.3-debian-12-r0 | ||
| - name: keycloak-config-cli | ||
| image: docker.io/bitnami/keycloak-config-cli:6.4.0-debian-12-r11 | ||
| licenses: Apache-2.0 | ||
| tanzuCategory: application | ||
| apiVersion: v2 | ||
| appVersion: 26.3.3 | ||
| dependencies: | ||
| - condition: postgresql.enabled | ||
| name: postgresql | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| version: 16.x.x | ||
| - name: common | ||
| repository: oci://registry-1.docker.io/bitnamicharts | ||
| tags: | ||
| - bitnami-common | ||
| version: 2.x.x | ||
| description: Keycloak is a high performance Java-based identity and access management | ||
| solution. It lets developers add an authentication layer to their applications with | ||
| minimum effort. | ||
| home: https://bitnami.com | ||
| icon: https://dyltqmyl993wv.cloudfront.net/assets/stacks/keycloak/img/keycloak-stack-220x234.png | ||
| keywords: | ||
| - keycloak | ||
| - access-management | ||
| maintainers: | ||
| - name: Broadcom, Inc. All Rights Reserved. | ||
| url: https://github.com/bitnami/charts | ||
| name: keycloak | ||
| sources: | ||
| - https://github.com/bitnami/charts/tree/main/bitnami/keycloak | ||
| version: 25.2.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Keycloak Helm Deployment | ||
| ## Overview | ||
|
|
||
| This repository contains configuration files for deploying Keycloak on Kubernetes using the official Bitnami Legacy Keycloak Helm chart. | ||
|
|
||
| Keycloak provides identity and access management (IAM) with support for Single Sign-On (SSO), OAuth2, OpenID Connect, and SAML. | ||
|
|
||
|
|
||
| # Prerequisites | ||
|
|
||
| Ensure the following are installed: | ||
|
|
||
| Kubernetes cluster (K8s v1.23+ recommended) | ||
|
|
||
| Helm v3+ | ||
|
|
||
| kubectl configured to access your cluster | ||
|
|
||
| Bitnami Sealed Secrets | ||
|
|
||
| External database (PostgreSQL) | ||
|
|
||
|
|
||
| ## Install Keycloak | ||
| ```bash | ||
| helm install keycloak ./keycloak-next --namespace keycloak -f values.yaml | ||
| ``` | ||
|
|
||
| ## Upgrade Release | ||
| ```bash | ||
| helm upgrade keycloak ./keycloak-next --namespace keycloak -f values.yaml | ||
| ``` | ||
|
|
||
| ## Uninstall Keycloak | ||
| ```bash | ||
| helm uninstall keycloak --namespace keycloak | ||
| ``` | ||
|
|
||
|
|
||
| ## Access Keycloak | ||
| ```bash | ||
| export SERVICE_PORT=$(kubectl get --namespace keycloak -o jsonpath="{.spec.ports[?(@.name=='http')].port}" services keycloak) | ||
|
|
||
| kubectl port-forward --namespace keycloak svc/keycloak ${SERVICE_PORT}:${SERVICE_PORT} & | ||
| ``` | ||
|
|
||
|
|
||
| # Using Sealed Secrets | ||
|
|
||
| ### Generate Secret: | ||
| ```bash | ||
| kubectl create secret generic keycloak-secret \ | ||
| --from-literal=postgresql-password="YOUR_DB_PASSWORD" \ | ||
| --dry-run=client -o yaml > keycloak-secret.yaml | ||
| ``` | ||
|
|
||
| ### Seal it: | ||
| ```bash | ||
| kubeseal --format yaml < keycloak-secret.yaml > sealed-keycloak-secret.yaml | ||
| ``` | ||
| ### Apply: | ||
| ```bash | ||
| kubectl apply -f sealed-keycloak-secret.yaml | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Patterns to ignore when building packages. | ||
| # This supports shell glob matching, relative path matching, and | ||
| # negation (prefixed with !). Only one pattern per line. | ||
| .DS_Store | ||
| # Common VCS dirs | ||
| .git/ | ||
| .gitignore | ||
| .bzr/ | ||
| .bzrignore | ||
| .hg/ | ||
| .hgignore | ||
| .svn/ | ||
| # Common backup files | ||
| *.swp | ||
| *.bak | ||
| *.tmp | ||
| *~ | ||
| # Various IDEs | ||
| .project | ||
| .idea/ | ||
| *.tmproj | ||
| .vscode/ | ||
| # img folder | ||
| img/ | ||
| # Changelog | ||
| CHANGELOG.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| annotations: | ||
| category: Infrastructure | ||
| licenses: Apache-2.0 | ||
| apiVersion: v2 | ||
| appVersion: 2.31.4 | ||
| description: A Library Helm Chart for grouping common logic between bitnami charts. | ||
| This chart is not deployable by itself. | ||
| home: https://bitnami.com | ||
| icon: https://dyltqmyl993wv.cloudfront.net/downloads/logos/bitnami-mark.png | ||
| keywords: | ||
| - common | ||
| - helper | ||
| - template | ||
| - function | ||
| - bitnami | ||
| maintainers: | ||
| - name: Broadcom, Inc. All Rights Reserved. | ||
| url: https://github.com/bitnami/charts | ||
| name: common | ||
| sources: | ||
| - https://github.com/bitnami/charts/tree/main/bitnami/common | ||
| type: library | ||
| version: 2.31.4 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So @sahithya23 when we run this, it will use the current default kubectl context to deploy to the switched context env, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About Template Folder
The templates/ folder is part of the Helm chart structure. It contains the Kubernetes manifest templates that Helm renders at install time.
They define the Keycloak Kubernetes resources such as Deployment, Service, Secrets, etc. Helm uses these templates along with the values.yaml file to generate the actual manifests deployed to the cluster.
Since we are using prepackaged helm chart, template folder has all the resources, we are controlling their behavior through values.yaml file using enabled: true/false
with this helm chart these resources are created: stateful set, service, secrets, pvc.
We can have separate values file for each environment so that we can use same chart across all environments.
About kube context when running Helm
Yes, that's correct — when running the Helm install command, it will deploy to the currently active Kubernetes context set in the user's kubeconfig.