Possible wrong instructions in https://docs.csc.fi/cloud/rahti2/usage/cli/
# Problem
In section "Using a service account token", the presented code results in `system:image-pusher` role getting set to a user instead of a service account which we created.
~~~bash
oc create serviceaccount pusher
oc policy add-role-to-user system:image-pusher pusher
docker login -p $(oc sa get-token pusher) -u unused image-registry.apps.2.rahti.csc.fi
~~~
The use of `-z` flag is required to specify a service account.
~~~
oc policy add-role-to-user ROLE (USER | -z SERVICEACCOUNT) [USER ...] [flags] [options]
~~~
# Solution
~~~bash
oc policy add-role-to-user system:image-pusher -z pusher
~~~
# Additional info
~~~
❯ oc version
Client Version: v4.16.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Kubernetes Version: v1.28.2-3580+6216ea1e51a212-dirty
~~~
关闭于 2025-03-04 2 条评论