Skip to content

Commit 3cb8fa3

Browse files
docs: Fix IRSA example when deploying cluster-autoscaler from the latest kubernetes/autoscaler helm repo (#1090)
1 parent fc40053 commit 3cb8fa3

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

docs/spot-instances.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You need to install a daemonset to catch the 2 minute warning before termination
88
helm install stable/k8s-spot-termination-handler --namespace kube-system
99
```
1010

11-
In the following examples at least 1 worker group that uses on-demand instances is included. This worker group has an added node label that can be used in scheduling. This could be used to schedule any workload not suitable for spot instances but is important for the [cluster-autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler) as it might be end up unscheduled when spot instances are terminated. You can add this to the values of the [cluster-autoscaler helm chart](https://github.com/helm/charts/tree/master/stable/cluster-autoscaler):
11+
In the following examples at least 1 worker group that uses on-demand instances is included. This worker group has an added node label that can be used in scheduling. This could be used to schedule any workload not suitable for spot instances but is important for the [cluster-autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler) as it might be end up unscheduled when spot instances are terminated. You can add this to the values of the [cluster-autoscaler helm chart](https://github.com/kubernetes/autoscaler/tree/master/charts/cluster-autoscaler-chart):
1212

1313
```yaml
1414
nodeSelector:

examples/irsa/README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# IAM Roles for Service Accounts
22

3-
This example shows how to create an IAM role to be used for a Kubernetes `ServiceAccount`. It will create a policy and role to be used by the [cluster-autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler) using the [public Helm chart](https://github.com/helm/charts/tree/master/stable/cluster-autoscaler).
3+
This example shows how to create an IAM role to be used for a Kubernetes `ServiceAccount`. It will create a policy and role to be used by the [cluster-autoscaler](https://github.com/kubernetes/autoscaler/tree/master/cluster-autoscaler) using the [public Helm chart](https://github.com/kubernetes/autoscaler/tree/master/charts/cluster-autoscaler-chart).
44

55
The AWS documentation for IRSA is here: https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html
66

@@ -38,15 +38,15 @@ $ helm install cluster-autoscaler --namespace kube-system autoscaler/cluster-aut
3838
Ensure the cluster-autoscaler pod is running:
3939

4040
```
41-
$ kubectl --namespace=kube-system get pods -l "app.kubernetes.io/name=aws-cluster-autoscaler"
42-
NAME READY STATUS RESTARTS AGE
43-
cluster-autoscaler-aws-cluster-autoscaler-5545d4b97-9ztpm 1/1 Running 0 3m
41+
$ kubectl --namespace=kube-system get pods -l "app.kubernetes.io/name=aws-cluster-autoscaler-chart"
42+
NAME READY STATUS RESTARTS AGE
43+
cluster-autoscaler-aws-cluster-autoscaler-chart-5545d4b97-9ztpm 1/1 Running 0 3m
4444
```
4545

4646
Observe the `AWS_*` environment variables that were added to the pod automatically by EKS:
4747

4848
```
49-
kubectl --namespace=kube-system get pods -l "app.kubernetes.io/name=aws-cluster-autoscaler" -o yaml | grep -A3 AWS_ROLE_ARN
49+
kubectl --namespace=kube-system get pods -l "app.kubernetes.io/name=aws-cluster-autoscaler-chart" -o yaml | grep -A3 AWS_ROLE_ARN
5050
5151
- name: AWS_ROLE_ARN
5252
value: arn:aws:iam::xxxxxxxxx:role/cluster-autoscaler
@@ -57,7 +57,7 @@ kubectl --namespace=kube-system get pods -l "app.kubernetes.io/name=aws-cluster-
5757
Verify it is working by checking the logs, you should see that it has discovered the autoscaling group successfully:
5858

5959
```
60-
kubectl --namespace=kube-system logs -l "app.kubernetes.io/name=aws-cluster-autoscaler"
60+
kubectl --namespace=kube-system logs -l "app.kubernetes.io/name=aws-cluster-autoscaler-chart"
6161
6262
I0128 14:59:00.901513 1 auto_scaling_groups.go:354] Regenerating instance to ASG map for ASGs: [test-eks-irsa-worker-group-12020012814125354700000000e]
6363
I0128 14:59:00.969875 1 auto_scaling_groups.go:138] Registering ASG test-eks-irsa-worker-group-12020012814125354700000000e

examples/irsa/cluster-autoscaler-chart-values.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ awsRegion: us-west-2
33
rbac:
44
create: true
55
serviceAccount:
6+
# This value should match local.k8s_service_account_name in locals.tf
7+
name: cluster-autoscaler-aws-cluster-autoscaler-chart
68
annotations:
9+
# This value should match the ARN of the role created by module.iam_assumable_role_admin in irsa.tf
710
eks.amazonaws.com/role-arn: "arn:aws:iam::<ACCOUNT ID>:role/cluster-autoscaler"
811

912
autoDiscovery:

examples/irsa/locals.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
locals {
22
cluster_name = "test-eks-irsa"
33
k8s_service_account_namespace = "kube-system"
4-
k8s_service_account_name = "cluster-autoscaler-aws-cluster-autoscaler"
4+
k8s_service_account_name = "cluster-autoscaler-aws-cluster-autoscaler-chart"
55
}

0 commit comments

Comments
 (0)