- Create a management EKS cluster in a single zone
- Use SPOT instances
- Use Amazon Linux AMI (Currently Bottlerocket doesn't work and having issues with AL2023)
- Install and configure Karpenter
- Install and configure Flux
- Write a secret that contains the cluster's specific variables that will be used with Flux. (please refer to variables substitutions)
- Deploy Cilium
- Edit the file
backend.tf
and put your own S3 bucket name. - Create a file that contains your own variables. Here's an example:
variables.tfvars
env = "dev"
cluster_name = "mycluster-0"
flux_sync_repository_url = "https://github.com/Smana/cloud-native-ref.git"
tags = {
GithubRepo = "cloud-native-ref"
GithubOrg = "Smana"
}
karpenter_limits = {
"default" = {
cpu = "20"
memory = "64Gi"
}
"io" = {
cpu = "20"
memory = "64Gi"
}
}
# Optional if an external OIDC provider should be used to authenticate users
cluster_identity_providers = {
zitadel = {
client_id = "702vqsrjicklgb7c5b7b50i1gc"
issuer_url = "https://auth.cloud.ogenki.io"
username_claim = "email"
groups_claim = "groups"
}
}
- Apply with
:information_source: Git branch or tag in the format refs/heads/main or refs/tags/v1.0.0
tofu apply -var-file variables.tfvars --var=git_ref=<flux_git_ref>
In order to really clean everything you should follow these steps:
-
Suspend Flux reconciliations
flux suspend kustomization --all
-
Delete
Gateways
(These create AWS loadbalancers)kubectl delete gateways --all-namespaces --all
-
Wait 3/4 minutest and delete all
IRSA
andEPI
kubectl delete irsa,epi --all-namespaces --all
-
tofu destroy --var-file variables.tfvars
One step:
flux suspend kustomization --all && \
kubectl delete gateways --all-namespaces --all && sleep 60 && \
kubectl delete irsa,epi --all-namespaces --all && sleep 30 && \
tofu destroy --var-file variables.tfvars
Name | Version |
---|---|
terraform | ~> 1.4 |
aws | ~> 5.0 |
flux | 1.4.0 |
github | ~> 6.0 |
helm | >= 2.7 |
http | >= 3.4 |
kubectl | >= 2.0.0 |
kubernetes | >= 2.20 |
random | ~> 3.5 |
tls | ~> 4.0 |
Name | Version |
---|---|
aws | ~> 5.0 |
aws.virginia | ~> 5.0 |
helm | >= 2.7 |
http | >= 3.4 |
kubectl | >= 2.0.0 |
kubernetes | >= 2.20 |
Name | Source | Version |
---|---|---|
eks | terraform-aws-modules/eks/aws | ~> 20 |
irsa_crossplane | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | 5.52.2 |
irsa_ebs_csi_driver | terraform-aws-modules/iam/aws//modules/iam-role-for-service-accounts-eks | 5.52.2 |
karpenter | terraform-aws-modules/eks/aws//modules/karpenter | ~> 20.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
cilium_version | Cilium cluster version | string |
"1.16.5" |
no |
cluster_identity_providers | Map of cluster identity provider configurations to enable for the cluster. | any |
{} |
no |
cluster_name | Name of the EKS cluster to be created | string |
n/a | yes |
cluster_version | k8s cluster version | string |
"1.31" |
no |
ebs_csi_driver_chart_version | EBS CSI Driver Helm chart version | string |
"2.25.0" |
no |
enable_flux_image_update_automation | Enable Flux image update automation | bool |
false |
no |
enable_ssm | If true, allow to connect to the instances using AWS Systems Manager | bool |
false |
no |
env | The environment of the EKS cluster | string |
n/a | yes |
flux_git_ref | Git branch or tag in the format refs/heads/main or refs/tags/v1.0.0 | string |
n/a | yes |
flux_operator_version | Flux Operator version | string |
"0.12.0" |
no |
flux_sync_repository_url | The repository URL to sync with Flux | string |
n/a | yes |
gateway_api_version | Gateway API CRDs version | string |
"v1.2.0" |
no |
github_token_secretsmanager_id | SecretsManager id from where to retrieve the Github Personal Access Token. (The key must be 'github-token') | string |
"github/flux-github-pat" |
no |
iam_role_additional_policies | Additional policies to be added to the IAM role | map(string) |
{} |
no |
karpenter_limits | Define limits for Karpenter per node pool. | map(object( |
n/a | yes |
karpenter_version | Karpenter version | string |
"1.1.1" |
no |
region | AWS Region | string |
"eu-west-3" |
no |
tags | A map of tags to add to all resources | map(string) |
{} |
no |
No outputs.