|
| 1 | +--- |
| 2 | +title: Keycloak |
| 3 | +sidebarTitle: Keycloak |
| 4 | +layout: ../_core/DocsLayout |
| 5 | +category: Learn |
| 6 | +permalink: /learn/keycloak/ |
| 7 | +# sublinks: Introduction, NGINX Config for Keycloak, Default Configuration, Administration UI |
| 8 | +next: /learn/installCLI/ |
| 9 | +--- |
| 10 | + |
| 11 | +## Introduction |
| 12 | + |
| 13 | +### What is Keycloak? |
| 14 | +Keycloak is an open-source identity and access management solution. It provides login, single sign-on (SSO), user management, and role-based access control (RBAC) for applications. |
| 15 | +HKube uses Keycloak to manage authentication and authorization across its components. |
| 16 | +Below is the login screen used in the HKube platform: |
| 17 | +[Insert screenshot of your HKube Keycloak login screen here] |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## NGINX Config for Keycloak |
| 22 | + |
| 23 | +### Patch Ingress Config |
| 24 | + |
| 25 | +To allow large headers required by Keycloak, the NGINX ingress controller must be patched. Run the following commands: |
| 26 | + |
| 27 | +<pre class="bash" id="patchIngress"> |
| 28 | +kubectl patch configmap ingress-nginx-controller -n ingress-nginx \ |
| 29 | + --type merge \ |
| 30 | + -p '{"data": { |
| 31 | + "large-client-header-buffers": "4 128k", |
| 32 | + "proxy-buffer-size": "128k", |
| 33 | + "proxy-buffers": "4 128k", |
| 34 | + "proxy-busy-buffers-size": "128k" |
| 35 | + }}' |
| 36 | +kubectl delete pod -n ingress-nginx -l app.kubernetes.io/component=controller <button class="copy-btn" onclick="copyToClipboard('patchIngress')">Copy</button> |
| 37 | +</pre> |
| 38 | + |
| 39 | +This configuration allows NGINX to handle larger authentication headers used by Keycloak. |
| 40 | + |
| 41 | +--- |
| 42 | + |
| 43 | +## Default Configuration |
| 44 | + |
| 45 | +### Users |
| 46 | + |
| 47 | +HKube includes several default users that are created during setup: |
| 48 | + |
| 49 | +- `guest / guestPassword` — member of `hkube-guests` |
| 50 | +- `viewer / viewerPassword` — member of `hkube-viewers` |
| 51 | +- `developer / developerPassword` — member of `hkube-developers` |
| 52 | + |
| 53 | +These users are part of predefined Keycloak groups that control their access within the system. |
| 54 | + |
| 55 | +### Groups |
| 56 | + |
| 57 | +User permissions are assigned via groups: |
| 58 | + |
| 59 | +- **hkube-developers** – Full access: delete, edit, view, and execute |
| 60 | +- **hkube-viewers** – Can view and edit |
| 61 | +- **hkube-guests** – View-only access |
| 62 | + |
| 63 | +> Note: Group membership maps users to specific roles in the `api-server` client. |
| 64 | +
|
| 65 | +### Roles |
| 66 | + |
| 67 | +Roles define the actual permissions enforced by HKube’s backend. These are client roles defined under the `api-server` Keycloak client: |
| 68 | + |
| 69 | +- `hkube_api_delete` – Allows deletion of HKube objects |
| 70 | +- `hkube_api_edit` – Allows editing of HKube objects |
| 71 | +- `hkube_api_view` – Allows viewing of HKube objects |
| 72 | +- `hkube_api_execute` – Allows execution of HKube objects |
| 73 | + |
| 74 | +--- |
| 75 | + |
| 76 | +## Administration UI |
| 77 | + |
| 78 | +### Keycloak Admin Console |
| 79 | + |
| 80 | +To manage users, groups, clients, and roles, access the Keycloak Admin Console. |
| 81 | + |
| 82 | +- **URL:** `https://<your_domain>/hkube/keycloak/` - for example with Minikube: `https://192.168.49.2/hkube/keycloak/` |
| 83 | +- **Username:** `admin` |
| 84 | +- **Password:** `admin` |
| 85 | + |
| 86 | +> These are default credentials and should be changed in production environments to avoid security risks. |
| 87 | +
|
| 88 | +--- |
| 89 | + |
| 90 | +## Summary of Permissions in HKube |
| 91 | + |
| 92 | +HKube uses Keycloak roles and groups to manage access: |
| 93 | + |
| 94 | +| Group | Permissions | |
| 95 | +|------------------|--------------------------------------------------| |
| 96 | +| hkube-developers | view, edit, delete, execute | |
| 97 | +| hkube-viewers | view, edit | |
| 98 | +| hkube-guests | view only | |
| 99 | + |
| 100 | +<p> </p> |
| 101 | + |
| 102 | +| Role | Description | |
| 103 | +|---------------------|--------------------------------------| |
| 104 | +| hkube_api_view | Can view pipelines and algorithms | |
| 105 | +| hkube_api_edit | Can modify pipelines and algorithms | |
| 106 | +| hkube_api_delete | Can delete pipelines and algorithms | |
| 107 | +| hkube_api_execute | Can run pipelines | |
| 108 | + |
| 109 | +These roles are mapped to users through their group memberships in Keycloak. |
| 110 | + |
| 111 | +<script> |
| 112 | + function copyToClipboard(elementId) { |
| 113 | + const codeBlock = document.getElementById(elementId); |
| 114 | + const button = codeBlock.querySelector('.copy-btn'); |
| 115 | + |
| 116 | + const text = Array.from(codeBlock.childNodes) |
| 117 | + .filter(node => node.nodeType === Node.TEXT_NODE || node.tagName !== 'BUTTON') |
| 118 | + .map(node => node.textContent) |
| 119 | + .join('') |
| 120 | + .trim(); |
| 121 | + |
| 122 | + navigator.clipboard.writeText(text).then(() => { |
| 123 | + const original = button.textContent; |
| 124 | + button.textContent = 'Copied!'; |
| 125 | + setTimeout(() => { button.textContent = original; }, 500); |
| 126 | + }).catch((err) => { |
| 127 | + console.error('Copy failed', err); |
| 128 | + }); |
| 129 | + } |
| 130 | +</script> |
0 commit comments