How to access EKS clusters generated by pltf.
Kubeconfig
- Fetch outputs:
Note
k8s_cluster_name,k8s_endpoint, andk8s_ca_data. - Update kubeconfig: Use the same AWS profile that has access to the environment account (or backend profile if you share credentials).
Generated Terraform already configures Kubernetes and Helm providers using these outputs when you run pltf terraform plan/apply.
AWS IAM to Kubernetes RBAC
EKS uses the aws-auth ConfigMap in kube-system to map IAM users/roles to Kubernetes groups.
Example aws-auth data:
apiVersion: v1
data:
mapRoles: |
- groups: ['system:bootstrappers', 'system:nodes']
rolearn: arn:aws:iam::ACCOUNT_ID:role/pltf-live-example-dev-eks-default-node-group
username: system:node:{{EC2PrivateDNSName}}
- groups: ['system:masters']
rolearn: arn:aws:iam::ACCOUNT_ID:role/demo-admin
username: pltf-managed
mapUsers: |
- groups: ['system:masters']
userarn: arn:aws:iam::ACCOUNT_ID:user/demo-admin
username: pltf-managed
rolearn/userarn: IAM principal.
- username: friendly alias.
- groups: Kubernetes RBAC groups (use system:masters for admin).
Granting access via pltf
Use admin_arns on aws_k8s_base to inject IAM admins without editing Kubernetes directly:
modules:
- type: aws_k8s_base
admin_arns:
- "arn:aws:iam::123456789012:user/platform-admin"
- "arn:aws:iam::123456789012:role/platform-admin"
Viewing RBAC bindings
kubectl get clusterrolebindings -o json | jq -r '.items[] | select(.subjects[0].kind==\"Group\") | .metadata.name'
kubectl get rolebindings -A -o json | jq -r '.items[] | select(.subjects[0].kind==\"Group\") | .metadata.name'
Example cluster role binding:
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: my-cluster-role-binding
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:discovery
subjects:
- apiGroup: rbac.authorization.k8s.io
kind: Group
name: my-group
my-group the permissions of system:discovery across all namespaces.
Summary
- Use
aws eks update-kubeconfigwith cluster outputs to get access. - Add IAM admins via
admin_arnsonaws_k8s_base(maps tosystem:masters). - For custom RBAC, edit
aws-author create your own role/cluster role bindings.