|
| 1 | +//!!NODE_ROOT <section> |
| 2 | +[.topic] |
| 3 | +[[default-roles-users,default-roles-users.title]] |
| 4 | += Understand Amazon EKS created RBAC roles and users |
| 5 | +:info_titleabbrev: Default roles and users |
| 6 | + |
| 7 | +include::../attributes.txt[] |
| 8 | + |
| 9 | +[abstract] |
| 10 | +-- |
| 11 | +Learn about the Kubernetes roles and users that Amazon EKS creates for cluster components and add-ons. Amazon EKS uses these role-based authorization control (RBAC) identities to operate the cluster. |
| 12 | +-- |
| 13 | + |
| 14 | +When you create a [.noloc]`Kubernetes` cluster, several default [.noloc]`Kubernetes` identities are created on that cluster for the proper functioning of [.noloc]`Kubernetes`. Amazon EKS creates [.noloc]`Kubernetes` identities for each of its default components. The identities provide [.noloc]`Kubernetes` role-based authorization control (RBAC) for the cluster components. For more information, see https://kubernetes.io/docs/reference/access-authn-authz/rbac/[Using RBAC Authorization] in the [.noloc]`Kubernetes` documentation. |
| 15 | + |
| 16 | +When you install optional <<eks-add-ons,add-ons>> to your cluster, additional [.noloc]`Kubernetes` identities might be added to your cluster. For more information about identities not addressed by this topic, see the documentation for the add-on. |
| 17 | + |
| 18 | +You can view the list of Amazon EKS created [.noloc]`Kubernetes` identities on your cluster using the {aws-management-console} or `kubectl` command line tool. All of the user identities appear in the `kube` audit logs available to you through Amazon CloudWatch. |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +*{aws-management-console}*:: |
| 23 | + |
| 24 | +.Prerequisite |
| 25 | +The link:IAM/latest/UserGuide/id_roles.html#iam-term-principal[IAM principal,type="documentation"] that you use must have the permissions described in <<view-kubernetes-resources-permissions,Required permissions>>. |
| 26 | ++ |
| 27 | +.. Open the link:eks/home#/clusters[Amazon EKS console,type="console"]. |
| 28 | +.. In the *Clusters* list, choose the cluster that contains the identities that you want to view. |
| 29 | +.. Choose the *Resources* tab. |
| 30 | +.. Under *Resource types*, choose *Authorization*. |
| 31 | +.. Choose, *ClusterRoles*, *ClusterRoleBindings*, *Roles*, or *RoleBindings*. All resources prefaced with *eks* are created by Amazon EKS. Additional Amazon EKS created identity resources are: |
| 32 | ++ |
| 33 | +*** The *ClusterRole* and *ClusterRoleBinding* named *aws-node*. The *aws-node* resources support the <<managing-vpc-cni,Amazon VPC CNI plugin for Kubernetes>>, which Amazon EKS installs on all clusters. |
| 34 | +*** A *ClusterRole* named *vpc-resource-controller-role* and a *ClusterRoleBinding* named *vpc-resource-controller-rolebinding*. These resources support the https://github.com/aws/amazon-vpc-resource-controller-k8s[Amazon VPC resource controller], which Amazon EKS installs on all clusters. |
| 35 | + |
| 36 | ++ |
| 37 | +In addition to the resources that you see in the console, the following special user identities exist on your cluster, though they're not visible in the cluster's configuration: |
| 38 | ++ |
| 39 | +*** *`eks:cluster-bootstrap`* – Used for `kubectl` operations during cluster bootstrap. |
| 40 | +*** *`eks:support-engineer`* – Used for cluster management operations. |
| 41 | +.. Choose a specific resource to view details about it. By default, you're shown information in *Structured view*. In the top-right corner of the details page you can choose *Raw view* to see all information for the resource. |
| 42 | + |
| 43 | + |
| 44 | +*Kubectl*:: |
| 45 | + |
| 46 | +.Prerequisite |
| 47 | +The entity that you use ({aws} Identity and Access Management (IAM) or [.noloc]`OpenID Connect` ([.noloc]`OIDC`)) to list the [.noloc]`Kubernetes` resources on the cluster must be authenticated by IAM or your [.noloc]`OIDC` identity provider. The entity must be granted permissions to use the [.noloc]`Kubernetes` `get` and `list` verbs for the `Role`, `ClusterRole`, `RoleBinding`, and `ClusterRoleBinding` resources on your cluster that you want the entity to work with. For more information about granting IAM entities access to your cluster, see <<grant-k8s-access>>. For more information about granting entities authenticated by your own [.noloc]`OIDC` provider access to your cluster, see <<authenticate-oidc-identity-provider>>. |
| 48 | +.To view Amazon EKS created identities using `kubectl` |
| 49 | +Run the command for the type of resource that you want to see. All returned resources that are prefaced with *eks* are created by Amazon EKS. In addition to the resources returned in the output from the commands, the following special user identities exist on your cluster, though they're not visible in the cluster's configuration: |
| 50 | ++ |
| 51 | +** *`eks:cluster-bootstrap`* – Used for `kubectl` operations during cluster bootstrap. |
| 52 | +** *`eks:support-engineer`* – Used for cluster management operations. |
| 53 | ++ |
| 54 | +*ClusterRoles* – `ClusterRoles` are scoped to your cluster, so any permission granted to a role applies to resources in any [.noloc]`Kubernetes` namespace on the cluster. |
| 55 | ++ |
| 56 | +The following command returns all of the Amazon EKS created [.noloc]`Kubernetes` `ClusterRoles` on your cluster. |
| 57 | ++ |
| 58 | +[source,bash,subs="verbatim,attributes"] |
| 59 | +---- |
| 60 | +kubectl get clusterroles | grep eks |
| 61 | +---- |
| 62 | ++ |
| 63 | +In addition to the `ClusterRoles` returned in the output that are prefaced with, the following `ClusterRoles` exist. |
| 64 | ++ |
| 65 | +** *`aws-node`* – This `ClusterRole` supports the <<managing-vpc-cni,Amazon VPC CNI plugin for Kubernetes>>, which Amazon EKS installs on all clusters. |
| 66 | +** *`vpc-resource-controller-role`* – This `ClusterRole` supports the https://github.com/aws/amazon-vpc-resource-controller-k8s[Amazon VPC resource controller], which Amazon EKS installs on all clusters. |
| 67 | + |
| 68 | ++ |
| 69 | +To see the specification for a `ClusterRole`, replace [.replaceable]`eks:k8s-metrics` in the following command with a `ClusterRole` returned in the output of the previous command. The following example returns the specification for the [.replaceable]`eks:k8s-metrics` `ClusterRole`. |
| 70 | ++ |
| 71 | +[source,bash,subs="verbatim,attributes"] |
| 72 | +---- |
| 73 | +kubectl describe clusterrole eks:k8s-metrics |
| 74 | +---- |
| 75 | ++ |
| 76 | +An example output is as follows. |
| 77 | ++ |
| 78 | +[source,bash,subs="verbatim,attributes"] |
| 79 | +---- |
| 80 | +Name: eks:k8s-metrics |
| 81 | +Labels: <none> |
| 82 | +Annotations: <none> |
| 83 | +PolicyRule: |
| 84 | + Resources Non-Resource URLs Resource Names Verbs |
| 85 | + --------- ----------------- -------------- ----- |
| 86 | + [/metrics] [] [get] |
| 87 | + endpoints [] [] [list] |
| 88 | + nodes [] [] [list] |
| 89 | + pods [] [] [list] |
| 90 | + deployments.apps [] [] [list] |
| 91 | +---- |
| 92 | ++ |
| 93 | +*ClusterRoleBindings* – `ClusterRoleBindings` are scoped to your cluster. |
| 94 | ++ |
| 95 | +The following command returns all of the Amazon EKS created [.noloc]`Kubernetes` `ClusterRoleBindings` on your cluster. |
| 96 | ++ |
| 97 | +[source,bash,subs="verbatim,attributes"] |
| 98 | +---- |
| 99 | +kubectl get clusterrolebindings | grep eks |
| 100 | +---- |
| 101 | ++ |
| 102 | +In addition to the `ClusterRoleBindings` returned in the output, the following `ClusterRoleBindings` exist. |
| 103 | ++ |
| 104 | +** *`aws-node`* – This `ClusterRoleBinding` supports the <<managing-vpc-cni,Amazon VPC CNI plugin for Kubernetes>>, which Amazon EKS installs on all clusters. |
| 105 | +** *`vpc-resource-controller-rolebinding`* – This `ClusterRoleBinding` supports the https://github.com/aws/amazon-vpc-resource-controller-k8s[Amazon VPC resource controller], which Amazon EKS installs on all clusters. |
| 106 | +
|
| 107 | ++ |
| 108 | +To see the specification for a `ClusterRoleBinding`, replace [.replaceable]`eks:k8s-metrics` in the following command with a `ClusterRoleBinding` returned in the output of the previous command. The following example returns the specification for the [.replaceable]`eks:k8s-metrics` `ClusterRoleBinding`. |
| 109 | ++ |
| 110 | +[source,bash,subs="verbatim,attributes"] |
| 111 | +---- |
| 112 | +kubectl describe clusterrolebinding eks:k8s-metrics |
| 113 | +---- |
| 114 | ++ |
| 115 | +An example output is as follows. |
| 116 | ++ |
| 117 | +[source,bash,subs="verbatim,attributes"] |
| 118 | +---- |
| 119 | +Name: eks:k8s-metrics |
| 120 | +Labels: <none> |
| 121 | +Annotations: <none> |
| 122 | +Role: |
| 123 | + Kind: ClusterRole |
| 124 | + Name: eks:k8s-metrics |
| 125 | +Subjects: |
| 126 | + Kind Name Namespace |
| 127 | + ---- ---- --------- |
| 128 | + User eks:k8s-metrics |
| 129 | +---- |
| 130 | ++ |
| 131 | +*Roles* – `Roles` are scoped to a [.noloc]`Kubernetes` namespace. All Amazon EKS created `Roles` are scoped to the `kube-system` namespace. |
| 132 | ++ |
| 133 | +The following command returns all of the Amazon EKS created [.noloc]`Kubernetes` `Roles` on your cluster. |
| 134 | ++ |
| 135 | +[source,bash,subs="verbatim,attributes"] |
| 136 | +---- |
| 137 | +kubectl get roles -n kube-system | grep eks |
| 138 | +---- |
| 139 | ++ |
| 140 | +To see the specification for a `Role`, replace [.replaceable]`eks:k8s-metrics` in the following command with the name of a `Role` returned in the output of the previous command. The following example returns the specification for the [.replaceable]`eks:k8s-metrics` `Role`. |
| 141 | ++ |
| 142 | +[source,bash,subs="verbatim,attributes"] |
| 143 | +---- |
| 144 | +kubectl describe role eks:k8s-metrics -n kube-system |
| 145 | +---- |
| 146 | ++ |
| 147 | +An example output is as follows. |
| 148 | ++ |
| 149 | +[source,bash,subs="verbatim,attributes"] |
| 150 | +---- |
| 151 | +Name: eks:k8s-metrics |
| 152 | +Labels: <none> |
| 153 | +Annotations: <none> |
| 154 | +PolicyRule: |
| 155 | + Resources Non-Resource URLs Resource Names Verbs |
| 156 | + --------- ----------------- -------------- ----- |
| 157 | + daemonsets.apps [] [aws-node] [get] |
| 158 | + deployments.apps [] [vpc-resource-controller] [get] |
| 159 | +---- |
| 160 | ++ |
| 161 | +*RoleBindings* – `RoleBindings` are scoped to a [.noloc]`Kubernetes` namespace. All Amazon EKS created `RoleBindings` are scoped to the `kube-system` namespace. |
| 162 | ++ |
| 163 | +The following command returns all of the Amazon EKS created [.noloc]`Kubernetes` `RoleBindings` on your cluster. |
| 164 | ++ |
| 165 | +[source,bash,subs="verbatim,attributes"] |
| 166 | +---- |
| 167 | +kubectl get rolebindings -n kube-system | grep eks |
| 168 | +---- |
| 169 | ++ |
| 170 | +To see the specification for a `RoleBinding`, replace [.replaceable]`eks:k8s-metrics` in the following command with a `RoleBinding` returned in the output of the previous command. The following example returns the specification for the [.replaceable]`eks:k8s-metrics` `RoleBinding`. |
| 171 | ++ |
| 172 | +[source,bash,subs="verbatim,attributes"] |
| 173 | +---- |
| 174 | +kubectl describe rolebinding eks:k8s-metrics -n kube-system |
| 175 | +---- |
| 176 | ++ |
| 177 | +An example output is as follows. |
| 178 | ++ |
| 179 | +[source,bash,subs="verbatim,attributes"] |
| 180 | +---- |
| 181 | +Name: eks:k8s-metrics |
| 182 | +Labels: <none> |
| 183 | +Annotations: <none> |
| 184 | +Role: |
| 185 | + Kind: Role |
| 186 | + Name: eks:k8s-metrics |
| 187 | +Subjects: |
| 188 | + Kind Name Namespace |
| 189 | + ---- ---- --------- |
| 190 | + User eks:k8s-metrics |
| 191 | +---- |
| 192 | +
|
| 193 | +
|
0 commit comments