Wiki source code of Rancher 2

Version 24.4 by Diana Strebkova on 2026/04/20 09:15

Show last authors
1 Rancher is a Kubernetes management tool to deploy and run clusters anywhere and on any provider.
2
3 The following page can only cover some special topics. Please read the [[official Rancher documentation >>url:https://ranchermanager.docs.rancher.com/||rel="nofollow" shape="rect" class="external-link"]] to learn more about Rancher 2 and how to perform container management.
4
5 {{toc/}}
6
7 = (% style="letter-spacing:-0.01em" %)Role mapping(%%) =
8
9 No special permissions are assigned to Portal Admins. Currently, the only users with elevated permissions are users with //at least one// Project Admin role. For more info check out the [[Roles>>url:https://prd.sdc.t-systems.net/confluence/display/SDCLOUD/How+to+use+Rancher+2#HowtouseRancher2-Roles||shape="rect"]] chapter.
10
11 (% class="table-bordered" style="width:100.0%" %)
12 (% class="active" %)|=(% colspan="1" style="text-align: left;" %)(((
13 Project Role
14 )))|=(% colspan="1" style="text-align: left;" %)(((
15 Rancher 2 Global Role
16 )))|=(% colspan="1" style="text-align: left;" %)(((
17 Description
18 )))
19 |(% style="text-align:left" %)(((
20 Admin
21 )))|(% style="text-align:left" %)(((
22 Standard User
23 )))|(% colspan="1" style="text-align:left" %)(((
24 These users can create new clusters and use them. Standard users can also assign permissions for their clusters to other users.
25 )))
26 |(% style="text-align:left" %)(((
27 Master
28 )))|(% rowspan="3" style="text-align:left" %)(((
29 User-Base
30 )))|(% rowspan="3" style="text-align:left" %)(((
31 User-Base users have login-access only. But they can be added to clusters and namespaces.
32 )))
33 |(% style="text-align:left" %)(((
34 Developer
35 )))
36 |(% colspan="1" style="text-align:left" %)(((
37 Viewer
38 )))
39
40 = (% style="letter-spacing:-0.01em" %)Login to Rancher(%%) =
41
42 As a first step, go to the **Projects** page in the DevOps Portal, then click on Rancher2 in the **Tools** column of one of your projects:
43
44 (% class="confluence-embedded-file-wrapper confluence-embedded-manual-size" %)[[image:attach:Screenshot 2023-03-16 at 18.38.02.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="228" width="900"]]
45
46 Then login to Rancher using the Keycloak option.
47
48 [[image:attach:MicrosoftTeams-image (2).png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="453" width="900"]]
49
50 Click on the "Log in with Keycloak" button as shown in the above screenshot.
51
52 After you logged in, the welcome page will look different depending on the level of access you have.
53
54 These are the two options:
55
56 1. If you have at least one Project Admin Role you get **Standard User** global permissions in Rancher. This will also show the "Import Existing" and "Create" button (for adding a cluster)// //as seen in the screenshot below:
57 [[image:attach:MicrosoftTeams-image (3).png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="371" width="1000"]]
58
59 1. If you have no Project Admin Role, you get **User-Base** global permissions in Rancher. This means you cannot add new clusters. You will only see clusters for which somebody else has assigned you some permissions. The screenshot below shows how the welcome screen will look like:
60 [[image:attach:MicrosoftTeams-image (4).png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" width="1000"]]
61
62 = Roles =
63
64 == Global Roles ==
65
66 As mentioned, users will be a member of one of the following two Global Roles which contain Global Permissions.
67
68 (% class="table-bordered" %)
69 (% class="active" %)|=(% style="text-align: left;" %)(((
70 Display Name
71 )))|=(% style="text-align: left;" %)(((
72 Name
73 )))|=(% style="text-align: left;" %)(((
74 Permissions
75 )))
76 |(% style="text-align:left" %)(((
77 User-Base
78 )))|(% style="text-align:left" %)(((
79 user-base
80 )))|(% style="text-align:left" %)(((
81 * View/edit own preferences
82 * Create/manage personal API key
83 * View Global Settings (all sections)
84 )))
85 |(% colspan="1" style="text-align:left" %)(((
86 Standard User
87 )))|(% colspan="1" style="text-align:left" %)(((
88 user
89 )))|(% colspan="1" style="text-align:left" %)(((
90 * View/edit own preferences
91 * Create/manage personal API key
92 * View Global Settings (all sections)
93 * Create clusters (import or create)
94 * Cluster Management - See and manage own clusters
95 * Create Cloud Credentials
96 * View Cluster/Node drivers (Edit options are displayed but are not effective)
97 * Create new Cluster/Node drivers
98 * View PSP  (Create/Edit options are displayed but are not effective)
99 * View and Create PSA 
100 * View and Create RKE1 Node Templates
101 * View RKE1 cluster templates (Add option is displayed but not effective)
102 * View chart repo templates (relevance not clear)
103 )))
104
105 For more information regarding roles and permissions for Rancher 2 please access the following link: [[https:~~/~~/ranchermanager.docs.rancher.com/>>url:https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/global-permissions||shape="rect"]]
106
107 == Cluster and Project Roles ==
108
109 Global roles are assigned based on the project role in the DevOps portal. In addition, roles at cluster or "project" level can be assigned, too. These roles are assigned within the Rancher UI and are not derived from any role in the DevOps portal.
110
111 {{info}}
112 The term "project" within Rancher has a different meaning than used in the DevOps portal. Within Rancher, a project is a collection of namespaces with some configuration, including roles for specific users.
113 {{/info}}
114
115 === Cluster Roles ===
116
117 Cluster roles define permissions for individual users for a specific cluster, see this [[Link>>url:https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles#cluster-roles||shape="rect"]] for further information from Rancher.
118
119 {{info}}
120 Cluster roles can only be granted by the cluster owner who created or imported the cluster.
121 {{/info}}
122
123 If roles shall be assigned to created or imported clusters, then follow this procedure:
124
125 1. Go to the Rancher homepage, where you see the list of managed clusters
126 1. Click on the "Manage" button, the Cluster Management page is opened
127 1. Click on the 3 dots on the right side of the line with the intended cluster → Click on "Edit config"
128 1. Extend "Member Roles" and Click on "Add Member".
129 [[image:attach:image-2023-4-25_11-2-51.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="254" width="646"]]
130 1. Start typing the full name of the user. There should be a suggestion displayed. Click on it.
131 1. In the role field, choose one of the built-in roles, see this [[Link>>url:https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles#cluster-roles||shape="rect"]] for the description of permissions per role.
132 1. Click on Save at the bottom of the page.
133
134 === Project Roles ===
135
136 Within a cluster, roles can be assigned for individual Rancher projects. This allows a more granular permission assignment within a cluster. See this [[Link>>url:https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles#project-roles||shape="rect"]] for further information.
137
138 {{info}}
139 Project roles can only be granted by a user with a sufficient role within the cluster.
140 {{/info}}
141
142 Follow this instruction to assign project roles to individual users:
143
144 1. In Rancher UI, switch to the cluster in which a project role shall be assigned.
145 1. In the menu on the left side, click on Cluster/Projects+Namespaces.
146 1. Switch to "Group by Project" presentation
147 [[image:attach:image-2023-4-25_11-13-6.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="113" width="934"]]
148 1. Search and find the project, for which you want to assign roles
149 1. In the line of this project (not the line with a namespace), click on the 3 dots on the right side → Click on Edit Config
150 1. Click on the Add (Members) button
151 [[image:attach:image-2023-4-25_11-16-29.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" width="400"]]
152 1. Start typing the full name of the user in the Select Member Field. There should be a suggestion displayed. Click on the entry with the full name (Local)
153 1. In the Project Permission field, select the intended role, see this [[Link>>url:https://ranchermanager.docs.rancher.com/how-to-guides/new-user-guides/authentication-permissions-and-global-configuration/manage-role-based-access-control-rbac/cluster-and-project-roles#project-roles||shape="rect"]] for further information.
154 1. Click on "Add".
155 1. Click on "Save" at the bottom of the page when all intended users have been are added.
156
157 = Helm charts =
158
159 == Add public helm chart ==
160
161 {{warning width="70" title="Chartmuseum Deprecation"}}
162 Chartmuseum is deprecated in new Harbor versions, we are migrating all helm charts to oci-compatible repositories in Harbor with "PKEY-helm" naming convention. For internal harbor repos, use new approach to add OCI chart repositories in rancher.
163 {{/warning}}
164
165 In this section, we describe (% style="color:#172b4d" %)how to add public helm charts like the one of DevOps-as-a-Service to a cluster to allow manual deployments.
166
167 (% id="HCreateAppRepositoryinRancher" class="p1" %)
168 === Create Chart Repository in Rancher ===
169
170 (% class="p1" %)
171 In Rancher UI, switch to the intended cluster and go to Apps/Repositories using the left side menu.
172 [[image:attach:Screenshot 2023-04-25 at 13.11.48.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="400" width="209"]]
173
174 (% class="p1" %)
175 Create a new Repository by clicking the Create button.
176
177 (% class="p1" %)
178 [[image:attach:Screenshot 2023-04-25 at 13.30.33.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="127" width="1100"]]
179
180 To add public oci-repository, navigate to repository create button and click it. For target, use OCI Repository like shown below:
181
182 [[image:1765207154466-828.png||height="298" width="821"]]
183
184 In the "Repository: Create" dialog, simply fill in the following fields. Authentication is not required.
185
186 (% class="wrapped" %)
187 |=(((
188 Field
189 )))|=(((
190 Value
191 )))
192 |=(((
193 Name
194 )))|(((
195 devopsaas-jenkins-auto-agent
196 )))
197 |=(((
198 Description
199 )))|(((
200 Public Helm charts as documented at [[https:~~/~~/docs.devops.t-systems.net>>url:https://docs.devops.t-systems.net||shape="rect"]]
201 )))
202 |=(((
203 Index URL
204 )))|(((
205 oci:~/~/registry.sdc.t-systems.net/devopsaas-helm/**<chartname>**, for example:
206
207 oci:~/~/registry.sdc.t-systems.net/devopsaas-helm/jenkins-auto-agent
208
209 {{box}}
210 Take into account, that all internal harbor repositories with helm charts have PKEY-helm naming convention, adding repo with both docker images and helm charts is not supported in rancher.
211 {{/box}}
212 )))
213
214 {{info}}
215 Now all internal helm charts are stored in harbor folders with -helm suffix. Adding the whole public project doesn't work natively anymore, so each separate chart should be added as a separate repo. //**If you have a need in adding the whole project with many repositories, please contact support for finding a possible solution.**//
216 {{/info}}
217
218 === Deploy Helm charts ===
219
220 Now go to Apps>Charts and filter if necessary for the devops-as-a-service Helm chart repository. Like shown below, a list of available charts is displayed. Simply click on one of the tiles to deploy them to your cluster.
221
222 Please note that the jenkins-lib charts are only generated for testing purposes. It doesn't make sense to deploy them. Your Jenkins is automatically retrieving the Jenkinslib directly using [[Git>>url:https://prd.sdc.t-systems.net/bitbucket/projects/DEVOPSAAS/repos/sdcloud-caas-jenkins-libs/browse||shape="rect"]].
223
224 [[image:attach:image-2023-5-19_16-1-52.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" width="1100"]]
225
226 == Add private chart repository ==
227
228 === Create a robot account in Harbor ===
229
230 To add project specific helm charts to Rancher, a Harbor robot account is needed, that is able to read helm charts and pull repositories. If you don't have such an account yet, please follow the instructions given in the [[Create Robot Account section of the Harbor documentation>>doc:Harbor.Harbor 2\.7 Robot Accounts.WebHome||anchor="create_robot_account"]] and make sure to grant at least the following permissions:
231
232 * Read Artifact
233 * Pull Repository
234
235 (% id="HCreateAppRepositoryinRancher-1" class="p1" %)
236 === Create App Repository in Rancher ===
237
238 (% class="p1" %)
239 In Rancher UI, switch to the intended cluster and go to Apps/Repositories using the left side menu.
240
241 [[image:attach:Screenshot 2023-04-25 at 13.11.48.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="400" width="209"]]
242
243 (% class="p1" %)
244 Create a new Repository by pressing the Create button.
245
246 (% class="p1" id="HTarget:http28s29URL-1" %)
247 [[image:attach:Screenshot 2023-04-25 at 13.30.33.png||data-xwiki-image-style-border="true" queryparams="effects=drop-shadow" height="127" width="1100"]]
248
249 (% id="HTarget:http28s29URL-1" class="p1" %)
250 ==== ====
251
252 {{info}}
253 Now all internal helm charts are stored in harbor folders with -helm suffix. Adding the whole public project doesn't work natively anymore, so each separate chart should be added as a separate repo.//** If you have a real need to add the whole project, please contact support for finding a possible solution.**//
254 {{/info}}
255
256 (% class="p1" %)
257 Choose OCI repository in Target and for url, use  ##oci:~/~/registry-<domain>.devops.t-systems.net/<project>-helm/<chartname>##
258
259 (% class="box" %)
260 (((
261 Replace ##<domain>## , ##<project>##  and ##<chartname> ##as necessary to match your set-up. Your charts should be stored in ##<project>-helm ##repository in Harbor, which is created by default when project is created in portal.
262 )))
263
264 (% class="p1" %)
265 For Authentication, select "Create a HTTP Basic Auth Secret" and provide the Username and Password of the Harbor robot account from the previous section.
266
267 (% class="wikigeneratedid" %)
268 [[image:1765208347952-345.36.18.png||height="449" width="849"]]
269
270 (% class="wikigeneratedid" %)
271 Click Create.
272
273 (% class="wrapped" %)
274 |=(((
275 Field
276 )))|=(((
277 Value
278 )))
279 |=(((
280 Name
281 )))|(((
282 sdcloud-sdportal
283 )))
284 |=(((
285 Description
286 )))|(((
287 Sdportal charts of sdcloud project
288 )))
289 |=(((
290 Index URL
291 )))|(((
292 oci:~/~/registry.sdc.t-systems.net/sdcloud-helm/sdportal
293
294 {{info}}
295 Now we should target a chart repo directly, not the whole project. In you need to reference the whole project with a lot of repos, please contact support to find a possible solution.
296 {{/info}}
297 )))
298
299 == Migrating chart repositories in rancher to new OCI Repository format ==
300
301 (% class="box warningmessage" %)
302 (((
303 ChartMuseum is being deprecated. After the migration is complete, **all harbor charts will be removed from ChartMuseum**, and **old HTTP(S)-based chart repositories will no longer work in Rancher (for internal harbor charts)**.
304 )))
305
306 (% class="box" %)
307 (((
308 **All your charts are available in the corresponding  `<pkey>-helm` OCI project.**
309 )))
310
311 There are two ways to migrate your repositories:
312
313 1. ##Direct Transition (Editing the Existing Repository)##
314 1*. Change the target to “OCI Repository”.
315 1*. Update the URL as required (the repository name cannot be changed) and add a new robot account for hel, check documentation above
316 1*. After saving, installed apps will automatically start using the updated repository.
317 1*. (% class="box" %)
318 (((
319 Important limitation: OCI repositories must point directly to a single chart repository, not to a parent folder.
320 If your old repository included several charts (for example “bitbucket” and “jira”), then after switching to OCI you can only target one chart (e.g. “bitbucket”).
321 The other charts will no longer receive updates through this repo, and you will still need to create additional repositories for each individual chart.
322 )))
323 1. Add New Repositories One by One (Recommended), preserve the old one till the end. This approach allows a smooth transition while the old ChartMuseum repository continues to function. You can:
324 1*. Create a new OCI repository for each chart,
325 1*. Keep the old ChartMuseum repo enabled during the migration,
326 1*. Migrate applications gradually following the steps described here.
327 1*. This avoids disruptions and allows controlled migration.
328
329 1. //Special Case: Old Repo Targeting Multiple Chart Repos//
330 If your existing repository targets multiple chart repositories and you need the new OCI setup to behave the same way, please **contact support.**
331
332 To ensure a smooth transition, we recommend to **add an OCI-based repository alongside the existing ChartMuseum repository** during the migration phase. If you don't w
333
334 | Term | Meaning
335 | **Old Repository** | The existing HTTP/HTTPS Harbor ChartMuseum repository.
336 | **New Repository** | The new OCI-based Helm chart repository created for your project (e.g. `<chart-repo-name>` in `<pkey>-helm`).
337
338 ##__**Why This Migration Is Required:**__##
339
340 * ##ChartMuseum is deprecated and will be removed.##
341 * ##Applications deployed from old repos keep a reference to that repo inside their labels.##
342 * ##Without updating the application to point to the new OCI repo, **Rancher will not detect new chart versions from new repository**.##
343
344 ## Migration Steps:##
345
346 1. ##Create the New OCI Repository in Rancher##
347 11. Go to **Apps → Repositories**.
348 11. Add a new repository of type **OCI**.
349 11. Name it similarly to your old repo name (e.g. `<chart-repo-name>-oci`). __**You can't name it the same and can't rename it later.**__
350 11. Point it to the new OCI endpoint.
351 1. ##Disable the Old ChartMuseum Repository Temporarily## 
352 ##This step ensures that Rancher resolves charts from the new OCI repo.##
353 11. Go to **Apps → Repositories**.
354 11. Disable the old HTTP(S)-based repository.
355 11. Keep it disabled until the migration is done.
356 [[image:1765548124989-482.59.06.png||height="152" width="485"]]
357 1. ##Update Existing Applications to Use the New OCI Repo##
358 Applications deployed with the old repository still contain the old repo name in their metadata. You must upgrade them once to transition.
359 11. Go to **Apps → Installed Apps**.
360 11. Open the application that was deployed using the old repo.
361 11. Click **Edit/Upgrade**.
362 [[image:1765548598644-830.png||height="138" width="811"]]
363 11. In the list of available chart repositories (scroll to the bottom), select the **new OCI repository**. Or enter the chart name in search bar:
364 [[image:1765548750604-334.png||height="293" width="308"]]
365 11. Choose the chart version you want to deploy (same or newer).
366 11. Click **Upgrade**.
367 1. ##Re-enable the Old Repository (Optional) ##
368 If you still need the old repo for other apps, re-enable it after the migration steps above.
369 **Note:** Even if a newer chart version exists in the old repository, your migrated app **will not see it**, because it is no longer connected to that repo
370
371 ##If you want to move an app back to the old repository:##
372
373 1. Temporarily disable the new OCI repo.
374 1. Enable the old ChartMuseum repo.
375 1. Open the application → **Upgrade**.
376 1. Select the chart from the old repo.
377 1. Save.
378
379 This will reconnect the app to the old repository.
380
381 = Automated deployments with Jenkins =
382
383 In this section, we describe(% style="color:#172b4d" %) how to set-up **automated builds, tests and deployments** for Jenkins.
384
385 == Prerequisites ==
386
387 In order to facilitate the connection between Jenkins and Rancher for the automatic deployments to be possible when a new software version is built, a new technical user to handle this action is required.
388
389 In case you don't have one, create a new technical user by following the instructions at [[Creating technical users>>doc:DevOps Portal for Admins.WebHome||anchor="creating_tech_users"]].
390
391 == (% style="color:#172b4d" %)Download kubeconfig(%%) ==
392
393 (% style="color:#172b4d" %)Connect to Rancher and navigate to your cluster, then in the right top menu, click "Download KubeConfig" as shown in the following image~:
394 [[image:attach:download_kubeconfig.png||height="150"]]
395
396 (% style="color:#172b4d" %)The downloaded kubeconfig file will have the same name as the cluster.
397
398 == Deploy kubeconfig to Jenkins ==
399
400 In order to be able to automatically deploy your software using Jenkins, follow the next steps:
401
402 * Login to your DevOps Portal account and click "Project Credentials" in the "Continuous Integration & Delivery" section.
403 [[image:image-2024-3-29_12-4-45.png||alt="https://prd.sdc.t-systems.net/confluence/download/attachments/118161601/image-2024-3-29_12-4-45.png?version=1&modificationDate=1711706685672&api=v2" data-xwiki-image-style-border="true" height="198"]]
404
405 * Click "Add Credentials"
406 * Upload the kubeconfig file:
407
408 [[image:image-2024-1-3_16-35-29.png||alt="https://prd.sdc.t-systems.net/confluence/download/attachments/118161601/image-2024-1-3_16-35-29.png?version=1&modificationDate=1704292529367&api=v2&effects=drop-shadow" data-xwiki-image-style-border="true" height="400"]]
409
410 * Choose "Secret file" from "Kind" dropdown
411 * Click "Browse" and select your previously downloaded kubeconfig file
412 * The "ID" field will be used in parameterized pipelines. We propose the prefix "kubeconfig-deployer-" followed by the project name (if the project name contains spaces, please replace them with "-") in order to be consistent and to make a clear differentiation between credential destinations. In the end, this is our proposal and conduct to follow, but of course you are free to name the credentials as you decide it fits best in your organization.
413 * For the "Description" field we suggest to provide details about the destination and use of these credentials.
414 * At the end, click "Create"
415
416 == Create a build and deploy pipeline ==
417
418 An application - more precisely, a helm chart - can now be built, tested and deployed automatically from Jenkins using the [[Jenkins Shared Library>>doc:Jenkins.Jenkins Shared Library.WebHome]] provided by DevOps-as-a-Service. Import the ##sdcloud## library in your Jenkinsfile and call the ##sdcPipeline## script, like shown in the following snippet:
419
420 {{code language="groovy"}}
421 @Library('sdcloud') _
422
423 sdcPipeline()
424 {{/code}}
425
426 The example above will run the build & deploy pipeline with its default configuration, which means
427
428 * Only the build and test steps will be executed but the built helm chart won't be deployed. To also include the deployment step, set the ##deployHelmChart## parameter to ##true##:
429 {{code language="groovy"}}sdcPipeline(deployHelmChart: true){{/code}}
430
431 * The smoke test step expects a service responding with an HTTP 20x for a request sent to path "/" and port 80 using http. If your service uses different paths, ports, protocols, or arguments, set the corresponding ##sdcPipeline## parameters ##containerProtocol##, ##containerPort##, ##containerContextPath##, and ##containerArgs## accordingly. E.g. to adapt the protocol and the context path, do
432 {{code language="groovy"}}sdcPipeline(
433 containerPort: 8080,
434 containerContextPath: '/solarcalculator'
435 ){{/code}}
436
437 There is a lot more to customize. Please refer to [[the customization section of the Jenkins Shared Library documentation>>doc:Jenkins.Jenkins Shared Library.WebHome||anchor="pipeline_customization"]] for the full list of parameters.