Skip to content

Commit 20cbb68

Browse files
author
Edvin N
authored
Initial EKS docs (#22)
* Initial EKS docs * Show repo structure * Small info about aws-azdo * Break glass info
1 parent a66e831 commit 20cbb68

File tree

3 files changed

+152
-4
lines changed

3 files changed

+152
-4
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
id: aws-azdo
3+
title: AWS azure-devops
4+
---
5+
6+
We use Azure DevOps to manage git repositories even if you are using AWS to deploy XKF and we run all our pipelines in Azure using VMSS just like in a Azure based XKF.
7+
8+
The main difference is that we use the AWS service connection.
9+
First you need to install the addon to Azure DevOps using the Azure marketplace,
10+
you can find more information how [here](https://docs.aws.amazon.com/vsts/latest/userguide/getting-started.html).
11+
12+
We will use two users when talking to AWS, one for our terraform pipelines and one for
13+
our gitops flow where we use Elastic Container Registry (ECR) to store the container images.
14+
15+
## Terraform
16+
17+
All this is possible to solve using Terraform but we currently don't have any terraform module to handle it so for now you can read about the manual steps.
18+
19+
- Create a IAM user
20+
- Tip put both these users under a specific path, for example CI
21+
- Save the credentials in a safe place
22+
- Attach IAM policy
23+
- AmazonEKSClusterPolicy
24+
- AdministratorAccess
25+
26+
## GitOps user
27+
28+
In our GitOps pipelines using flux we need to be able to push and delete containers in ECR.
29+
So very similar to how we created the terraform user:
30+
31+
- Create a IAM user
32+
- Tip put both these users under a specific path, for example CI
33+
- Save the credentials in a safe place
34+
- Attach IAM policy
35+
- AmazonEC2ContainerRegistryFullAccess

docs/xks/operator-guide/eks.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
id: eks
3+
title: EKS
4+
---
5+
6+
import useBaseUrl from '@docusaurus/useBaseUrl';
7+
8+
Xenit Kubernetes Framework supports both AKS and EKS, though AKS is our main platform.
9+
In this document we will describe how to setup XKF on EKS and how it differs from AKS.
10+
11+
## Differences
12+
13+
To setup XKF using EKS you still need a Azure environment.
14+
15+
XKF is heavy relying on Azure AD (AAD) and we have developed our own tool to
16+
manage access to our clusters called [azad-kube-proxy](https://github.com/XenitAB/azad-kube-proxy).
17+
18+
So our governance solution is still fully located in Azure together with our Terraform state
19+
20+
### Repo structure
21+
22+
This is how a AWS repo structure can look like:
23+
24+
```txt
25+
├── Makefile
26+
├── README.md
27+
├── aws-core
28+
│   ├── main.tf
29+
│   ├── outputs.tf
30+
│   ├── variables
31+
│   │   ├── common.tfvars
32+
│   │   ├── dev.tfvars
33+
│   │   ├── prod.tfvars
34+
│   │   └── qa.tfvars
35+
│   └── variables.tf
36+
├── aws-eks
37+
│   ├── main.tf
38+
│   ├── outputs.tf
39+
│   ├── variables
40+
│   │   ├── common.tfvars
41+
│   │   ├── dev.tfvars
42+
│   │   ├── prod.tfvars
43+
│   │   └── qa.tfvars
44+
│   └── variables.tf
45+
├── azure-governance
46+
│   ├── main.tf
47+
│   ├── outputs.tf
48+
│   ├── variables
49+
│   │   ├── common.tfvars
50+
│   │   ├── dev.tfvars
51+
│   │   ├── prod.tfvars
52+
│   │   └── qa.tfvars
53+
│   └── variables.tf
54+
├── global.tfvars
55+
```
56+
57+
### EKS
58+
59+
Just like in AKS we use Calico as our CNI.
60+
61+
- AWS CNI don't support network policies
62+
- AWS CNI heavily limits how many pods we can run on a single node
63+
- We want to be consistent with AKS
64+
65+
Just after setting up the EKS cluster we use a null_resource to first delete
66+
the AWS CNI daemon set and then install calico.
67+
This is all done before we add a single node to the cluster.
68+
69+
After this we add a eks node group and Calico starts.
70+
71+
### IRSA
72+
73+
In AKS we use AAD Pod Identity to support access to Azure resources.
74+
We support the same thing in EKS but use IAM roles for service accounts IRSA.
75+
76+
To make it easier to use IRSA we have developed a small terraform [module](https://github.com/XenitAB/terraform-modules/blob/main/modules/aws/irsa/README.md).
77+
78+
## Bootstrap
79+
80+
By default AWS CNI limits the amount of pods that you can have on a single node.
81+
Since we are using Calico we don't have this limit,
82+
but when setting up a default EKS environment the EKS [bootstrap script](https://github.com/awslabs/amazon-eks-ami/blob/master/files/bootstrap.sh)
83+
defines a pod limit. To remove this limit we have created our own AWS launch template for our EKS node group.
84+
85+
It sets `--use-max-pods false` and some needed kubernetes node labels, if these labels aren't set the EKS cluster is unable to "find" the nodes in the node group.
86+
87+
## Tenants account peering
88+
89+
In Azure we separates XKF and our tenants by using Resource Groups, in AWS we use separate accounts.
90+
91+
To setup a VPC peering you need to know the target VPC id, this creates a chicken and egg problem.
92+
To workaround this problem we sadly have to run the eks/core module multiple times in both the XKF side and the tenant.
93+
94+
Run Terraform in the following order:
95+
96+
- XKF core without any vpc_peering_config_requester defined.
97+
- Tenant core without any vpc_peering_config_accepter defined.
98+
- XKF core define vpc_peering_config_requester, manually getting the needed information from the tenant account.
99+
- Tenant core define vpc_peering_config_accepter, manually getting the needed information from the XKF account.
100+
101+
Make sure that you only have one peering request open at the same time, else the accepter side won't be able to find a unique request.
102+
Now you should be able to see the VPC peering connected on both sides.
103+
104+
## Break glass
105+
106+
We are very dependent on azad-proxy to work but if something happens with the
107+
ingress, azad-proxy or the AAD we need have ways of reaching the cluster.
108+
109+
```bash
110+
aws eks --region eu-west-1 update-kubeconfig --name dev-eks1 --alias dev-eks1 --role-arn arn:aws:iam::111111111111:role/xkf-eu-west-1-dev-eks-admin
111+
```

sidebars.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@ module.exports = {
1818
items: [
1919
"xks/developer-guide/introduction",
2020
"xks/developer-guide/best-practices",
21-
"xks/developer-guide/ingress",
2221
"xks/developer-guide/cd",
2322
"xks/developer-guide/cloud-iam",
23+
"xks/developer-guide/flux",
24+
"xks/developer-guide/ingress",
25+
"xks/developer-guide/linkerd",
2426
"xks/developer-guide/secrets-management",
2527
"xks/developer-guide/security",
26-
"xks/developer-guide/linkerd",
27-
"xks/developer-guide/flux",
2828
],
2929
},
3030
{
3131
type: "category",
3232
label: "Operator Guide",
3333
items: [
3434
"xks/operator-guide/index",
35-
"xks/operator-guide/operator-guide",
35+
"xks/operator-guide/aws-azdo",
3636
"xks/operator-guide/azure-devops-agents",
3737
"xks/operator-guide/blast-radius",
3838
"xks/operator-guide/blue-green",
39+
"xks/operator-guide/eks",
40+
"xks/operator-guide/operator-guide",
3941
],
4042
},
4143
],

0 commit comments

Comments
 (0)