You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,35 +21,40 @@ It allows you to assign roles to users, groups or `ServicesAccount` via `RoleBin
21
21
Key components of RBAC in Kubernetes include:
22
22
23
23
-**Roles and ClusterRoles:**
24
-
-**Roles:** These are specific to a namespace and define a set of permissions for resources within that namespace (e.g., pods, services).
25
-
-**ClusterRoles:** These are similar to roles but apply cluster-wide, spanning across all namespaces.
24
+
-`Roles`: These are specific to a namespace and define a set of permissions for resources within that namespace (e.g., pods, services).
25
+
-`ClusterRoles`: These are similar to roles but apply cluster-wide, spanning across all namespaces.
26
26
-**RoleBindings and ClusterRoleBindings:**
27
-
-**RoleBindings:** These associate a set of permissions defined in a role with a user, group, or service account within a specific namespace.
28
-
-**ClusterRoleBindings:** These associate a set of permissions defined in a ClusterRole with a user, group, or service account across the entire cluster.
27
+
-`RoleBindings`: These associate a set of permissions defined in a role with a user, group, or service account within a specific namespace.
28
+
-`ClusterRoleBindings`: These associate a set of permissions defined in a ClusterRole with a user, group, or service account across the entire cluster.
29
29
-**Subjects:** A subject in RBAC can be a user, a group, or a service account to which roles or cluster roles are bound.
30
30
-**Rules:** Rules are sets of permissions associated with roles or cluster roles. They specify what actions are allowed or denied on specific resources.
31
31
32
-
RBAC works seamlessly with Scaleway's IAM (Identity and Access Maanagement) system. Refer to [How to manage Kubeconfig files with IAM](/containers/kubernetes/how-to/manage-kubeconfig-with-iam/) for information how to configure IAM permissions for your users.
32
+
RBAC works seamlessly with Scaleway's IAM (Identity and Access Maanagement) system. [Identity and Access Management (IAM)](/iam/concepts/#iam) provides control over resource access. IAM policies enable the configuration of permissions for Kubernetes Kapsule clusters at the Project level.
33
+
34
+
An [IAM policy](/iam/concepts/#policy) defines the permissions for users, groups, and applications within an Organization. It consists of a [principal](/iam/concepts/#principal) (the user, group, or application to which it applies) and IAM rules that specify permission sets and their scope.
35
+
36
+
The combination of IAM and Kubernetes RBAC allows you to define fine-grained access levels for cluster users.
37
+
33
38
34
39
### Mapping IAM permission sets to Kubernetes groups
35
40
36
41
The following IAM permission sets are mapped to Kubernetes groups:
These groups can be edited and will not be reconciled by Kapsule/Kosmos. If these roles are misconfigured and cut off access to the cluster, the IAM permission set `KubernetesSystemMastersGroupAccess` should be assigned to the application or user. This permission set allows bypassing the entire RBAC layer.
55
60
@@ -60,134 +65,134 @@ Users or applications can be added to zero, one, or more IAM groups. IAM groups
Groups [scaleway:group:55eb7ac5-9afe-4e40-8d54-4fbb232cac21 scaleway:cluster-read system:authenticated]
66
71
```
67
72
68
73
## Creating a developers group with write access to dev and staging namespaces
69
74
70
-
1. Create an IAM developers group:
75
+
1. Create an [IAM group](/iam/how-to/create-group/) called `developers`:
71
76
- Assign the `KubernetesReadOnly` permission set to this group.
72
77
- Note the group ID, as it will be needed later.
73
78
74
-
2. Create Namespaces and Roles:
75
-
-As a user/app with `KubernetesFullAccess` or `KubernetesSystemMastersGroupAccess`, create the following manifests:
76
-
77
-
Namespace Creation:
78
-
79
-
```yaml
80
-
apiVersion: v1
81
-
kind: Namespace
82
-
metadata:
83
-
name: dev
84
-
---
85
-
apiVersion: v1
86
-
kind: Namespace
87
-
metadata:
88
-
name: staging
89
-
```
90
-
91
-
Role Creation for dev namespace:
92
-
93
-
```yaml
94
-
apiVersion: rbac.authorization.k8s.io/v1
95
-
kind: Role
96
-
metadata:
97
-
name: developers
98
-
namespace: dev
99
-
rules:
100
-
- apiGroups: ["*"]
101
-
resources: ["*"]
102
-
verbs: ["*"]
103
-
- nonResourceURLs: ["*"]
104
-
verbs: ["*"]
105
-
```
106
-
107
-
RoleBinding Creation for dev namespace:
108
-
109
-
```yaml
110
-
apiVersion: rbac.authorization.k8s.io/v1
111
-
kind: RoleBinding
112
-
metadata:
113
-
name: developers
114
-
namespace: dev
115
-
subjects:
116
-
- kind: Group
117
-
name: scaleway:groups:<GROUP_ID>
118
-
roleRef:
119
-
kind: Role
120
-
name: developers
121
-
apiGroup: rbac.authorization.k8s.io
122
-
```
123
-
124
-
Repeat the same operation for the staging namespace.
79
+
2. Create namespaces and roles:
80
+
As a user/app with `KubernetesFullAccess` or `KubernetesSystemMastersGroupAccess`, create the following manifests:
81
+
82
+
Namespace creation:
83
+
84
+
```yaml
85
+
apiVersion: v1
86
+
kind: Namespace
87
+
metadata:
88
+
name: dev
89
+
---
90
+
apiVersion: v1
91
+
kind: Namespace
92
+
metadata:
93
+
name: staging
94
+
```
95
+
96
+
Role creation for dev namespace:
97
+
98
+
```yaml
99
+
apiVersion: rbac.authorization.k8s.io/v1
100
+
kind: Role
101
+
metadata:
102
+
name: developers
103
+
namespace: dev
104
+
rules:
105
+
- apiGroups: ["*"]
106
+
resources: ["*"]
107
+
verbs: ["*"]
108
+
- nonResourceURLs: ["*"]
109
+
verbs: ["*"]
110
+
```
111
+
112
+
RoleBinding Creation for dev namespace:
113
+
114
+
```yaml
115
+
apiVersion: rbac.authorization.k8s.io/v1
116
+
kind: RoleBinding
117
+
metadata:
118
+
name: developers
119
+
namespace: dev
120
+
subjects:
121
+
- kind: Group
122
+
name: scaleway:groups:<GROUP_ID>
123
+
roleRef:
124
+
kind: Role
125
+
name: developers
126
+
apiGroup: rbac.authorization.k8s.io
127
+
```
128
+
129
+
Repeat the same operation for the staging namespace.
125
130
126
131
3. Apply the Manifests:
127
132
128
-
```bash
129
-
kubectl apply -f filename.yaml
130
-
```
133
+
```bash
134
+
kubectl apply -f filename.yaml
135
+
```
131
136
132
137
After these steps, members of the IAM group will have read access to the cluster and write access to the `dev` and `staging` namespaces. Permissions can be refined by modifying the `Role`.
133
138
134
139
## Assigning permissions to a specific user without using a group
135
140
136
-
1.**Assign the `KubernetesReadOnly` Permission Set to the User**.
137
-
2.**Retrieve the IAM User ID** and note it.
138
-
3.**Create the Following Manifests**:
139
-
140
-
Namespace creation:
141
-
142
-
```yaml
143
-
apiVersion: v1
144
-
kind: Namespace
145
-
metadata:
146
-
name: demo-sandbox
147
-
```
148
-
149
-
Role creation for an example namespace:
150
-
151
-
```yaml
152
-
apiVersion: rbac.authorization.k8s.io/v1
153
-
kind: Role
154
-
metadata:
155
-
name: example
156
-
namespace: example-sandbox
157
-
rules:
158
-
- apiGroups: ["*"]
159
-
resources: ["*"]
160
-
verbs: ["*"]
161
-
- nonResourceURLs: ["*"]
162
-
verbs: ["*"]
163
-
```
164
-
165
-
RoleBinding creation for the example namespace:
166
-
167
-
```yaml
168
-
apiVersion: rbac.authorization.k8s.io/v1
169
-
kind: RoleBinding
170
-
metadata:
171
-
name: example
172
-
namespace: example-sandbox
173
-
subjects:
174
-
- kind: User
175
-
name: scaleway:bearer:<USER_ID>
176
-
roleRef:
177
-
kind: Role
178
-
name: demo
179
-
apiGroup: rbac.authorization.k8s.io
180
-
```
141
+
1. Assign the `KubernetesReadOnly` Permission Set to the User.
142
+
2. Retrieve the **IAM user ID** and note it.
143
+
3. Create the following Manifests:
144
+
145
+
Namespace creation:
146
+
147
+
```yaml
148
+
apiVersion: v1
149
+
kind: Namespace
150
+
metadata:
151
+
name: demo-sandbox
152
+
```
153
+
154
+
Role creation for an example namespace:
155
+
156
+
```yaml
157
+
apiVersion: rbac.authorization.k8s.io/v1
158
+
kind: Role
159
+
metadata:
160
+
name: example
161
+
namespace: example-sandbox
162
+
rules:
163
+
- apiGroups: ["*"]
164
+
resources: ["*"]
165
+
verbs: ["*"]
166
+
- nonResourceURLs: ["*"]
167
+
verbs: ["*"]
168
+
```
169
+
170
+
RoleBinding creation for the example namespace:
171
+
172
+
```yaml
173
+
apiVersion: rbac.authorization.k8s.io/v1
174
+
kind: RoleBinding
175
+
metadata:
176
+
name: example
177
+
namespace: example-sandbox
178
+
subjects:
179
+
- kind: User
180
+
name: scaleway:bearer:<USER_ID>
181
+
roleRef:
182
+
kind: Role
183
+
name: demo
184
+
apiGroup: rbac.authorization.k8s.io
185
+
```
181
186
182
187
4. Apply the manifests:
183
188
184
-
```bash
185
-
kubectl apply -f filename.yaml
186
-
```
189
+
```bash
190
+
kubectl apply -f filename.yaml
191
+
```
187
192
188
-
User "demo" now has full rights in the `example-sandbox` namespace.
193
+
The user "demo" now has full rights in the `example-sandbox` namespace.
189
194
190
-
## Limiting `cluster-read` Access
195
+
## Limiting cluster-read Access
191
196
192
197
To modify the `scaleway:cluster-read` permissions, use the following command:
0 commit comments