NOT PORTED YET
- Best Practices
- EKS on Fargate
- EKS Kubectl Access
- Eksctl
- Get Cluster Version
- AWS Load Balancer
- Grant IAM Roles EKS Access
- EKS Resizeable Disk
- EKS Cluster Add-Ons
- EKS Cluster Upgrades
- Extended Support
https://docs.aws.amazon.com/eks/latest/best-practices/introduction.html
Serverless Kubernetes service to avoid having to deal with node pool management.
https://docs.aws.amazon.com/eks/latest/userguide/fargate.html
First install AWS CLI as per the AWS page.
Then run the eks_kube_creds.sh script from the DevOps-Bash-tools repo's aws/ directory.
This will find and configure kube config for all your kubernetes clusters in the current AWS account.
aws_kube_creds.shkubectl config get-contextsswitch to the cluster you want:
kubectl config use-context <name>kubectl get pods --all-namespacesThen see Kubernetes page for configs, scripts and .envrc.
The official CLI of EKS.
Easier to use than AWS CLI for EKS.
From DevOps-Bash-tools:
install_eksctl.shaws eks describe-cluster --name "$EKS_CLUSTER" --query "cluster.version" --output texthttps://kubernetes-sigs.github.io/aws-load-balancer-controller/latest/
https://docs.aws.amazon.com/eks/latest/userguide/grant-k8s-access.html
This is preferred as long as your cluster meets the version prerequisites.
Compare your cluster version and update using:
aws eks describe-cluster --name "$EKS_CLUSTER" \
--query 'cluster.{"Kubernetes Version": version, "Platform Version": platformVersion}'If new enable, enable it (this is irreversible):
aws eks update-cluster-config --name "$EKS_CLUSTER" --access-config authenticationMode='API_AND_CONFIG_MAP'Then create access entries:
aws eks create-access-entry --cluster-name "$EKS_CLUSTER" \
--principal-arn "arn:aws:iam::$AWS_ACCOUNT_ID:role/devs" \
--type STANDARD \
--user MyK8sRoleBinding \
--kubernetes-groups MyK8sRoleBindinghttps://docs.aws.amazon.com/eks/latest/userguide/access-entries.html
Use this if the cluster version is old or you don't want to change the access mode in production just yet.
WARNING: If you get this edit wrong you could lose access to your cluster
For this reason it is recommended to use eksctl to edit the AWS auth-map configmap for safety:
eksctl get iamidentitymapping --cluster "$EKS_CLUSTER"To get the role from an account currently authenticated using it:
AWS_ROLE="$(aws sts get-caller-identity --query 'Arn' --output text | sed 's|.*role/||; s|/.*$||' | tee /dev/stderr)"If using AWS SSO it's look something like AWSReservedSSO_<ROLE>_1234567890abcdef.
eksctl create iamidentitymapping --cluster "$EKS_CLUSTER" --arn "arn:aws:iam::$AWS_ACCOUNT_ID:role/$AWS_ROLE" --username 'admin:{{SessionName}}' --group 'system:masters' --no-duplicate-arnsSince you can't update, you would need to delete to modify the above,
for example if you missed off the :{{SessionName}} suffix to the --username 'admin'
eksctl delete iamidentitymapping --cluster $EKS_CLUSTER --arn="arn:aws:iam::$AWS_ACCOUNT_ID:role/$AWS_ROLE"See the configmap:
kubectl get -n kube-system configmap aws-auth -o yamlRaw old school editing method (DO NOT USE - see WARNING above):
kubectl edit -n kube-system configmap aws-authEither create a new storageclass that is resizeable and use that for all future apps:
storageclass-aws-standard-resizeable.yaml
Or patch the default storageclass:
$ kubectl get sc
NAME PROVISIONER RECLAIMPOLICY VOLUMEBINDINGMODE ALLOWVOLUMEEXPANSION AGE
ebs-sc (default) ebs.csi.aws.com Retain WaitForFirstConsumer true 134dkubectl patch sc ebs-sc -p '{"allowVolumeExpansion": true}'I've patched the default storage class in production and resized Atlantis data pvc using the same procedure as the Jenkins-on-Kubernetes notes , it works.
List clusters:
eksctl get clusteror
aws eks list-clustersList Available EKS cluster addons:
aws eks describe-addon-versions | jq -r '.addons[].addonName' | sortList eksctl installed EKS cluster addons (may not show ones installed by charts):
eksctl get addons --cluster "$EKS_CLUSTER"or
aws eks list-addons --cluster-name "$EKS_CLUSTER" --query 'addons[].addonName' --output textList version of a specific addon:
aws eks describe-addon --cluster-name "$EKS_CLUSTER" --addon-name vpc-cni --query "addon.addonVersion" --output textList addon pods:
kubectl get pods -n addonsSee the EKS Cluster Upgrades doc.
Extended support costs more, you may want to switch to standard support.
Note: this will force upgrades earlier when the cluster's version falls out of standard support, which is only 14 months, so you will need to plan and upgrade more regularly, which is recommended best practice anyway. See upgrade policy.
See the Available Versions and Release Calender for when you need to upgrade versions for Standard or Extended support.
You can always see available versions and their status of standard vs extended and dates via the AWS CLI.
(requires a fairly new version of AWS CLI)
brew upgrade awscliaws eks describe-cluster-versions --output tableDisable extended support and stay on the more recent versions only:
aws eks update-cluster-config --name "$EKS_CLUSTER" --upgrade-policy "supportType=STANDARD"