-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update Wireguard example to new layout
- Loading branch information
1 parent
7bb4e70
commit edb8492
Showing
8 changed files
with
352 additions
and
286 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
################################################################################ | ||
# Cluster | ||
################################################################################ | ||
|
||
module "eks" { | ||
source = "terraform-aws-modules/eks/aws" | ||
version = "~> 19.16" | ||
|
||
cluster_name = local.name | ||
cluster_version = "1.27" | ||
cluster_endpoint_public_access = true | ||
|
||
# EKS Addons | ||
cluster_addons = { | ||
coredns = {} | ||
kube-proxy = {} | ||
vpc-cni = {} | ||
} | ||
|
||
vpc_id = module.vpc.vpc_id | ||
subnet_ids = module.vpc.private_subnets | ||
|
||
eks_managed_node_groups = { | ||
initial = { | ||
instance_types = ["m5.large"] | ||
# Cilium Wireguard requires Linux Kernel 5.10 or above. | ||
# For EKS 1.24 and above, the AMI the Kernel version is 5.10 | ||
# For EKS 1.23 and below, you need to use Bottlerocket OS. For example: | ||
# ami_type = "BOTTLEROCKET_x86_64" | ||
# platform = "bottlerocket" | ||
min_size = 1 | ||
max_size = 3 | ||
desired_size = 2 | ||
} | ||
} | ||
# Extend node-to-node security group rules | ||
node_security_group_additional_rules = { | ||
# Cilium Wireguard Port https://github.com/cilium/cilium/blob/main/Documentation/security/network/encryption-wireguard.rst | ||
ingress_cilium_wireguard = { | ||
description = "Allow Cilium Wireguard node to node" | ||
protocol = "udp" | ||
from_port = 51871 | ||
to_port = 51871 | ||
type = "ingress" | ||
self = true | ||
} | ||
} | ||
|
||
tags = local.tags | ||
} | ||
|
||
################################################################################ | ||
# Kubectl Output | ||
################################################################################ | ||
|
||
output "configure_kubectl" { | ||
description = "Configure kubectl: make sure you're logged in with the correct AWS profile and run the following command to update your kubeconfig" | ||
value = "aws eks --region ${local.region} update-kubeconfig --name ${module.eks.cluster_name}" | ||
} | ||
|
||
################################################################################ | ||
# EKS Blueprints Addons | ||
################################################################################ | ||
|
||
module "eks_blueprints_addons" { | ||
source = "aws-ia/eks-blueprints-addons/aws" | ||
version = "~> 1.7" | ||
|
||
cluster_name = module.eks.cluster_name | ||
cluster_endpoint = module.eks.cluster_endpoint | ||
cluster_version = module.eks.cluster_version | ||
oidc_provider_arn = module.eks.oidc_provider_arn | ||
|
||
helm_releases = { | ||
cilium = { | ||
name = "cilium" | ||
chart = "cilium" | ||
version = "1.14.1" | ||
repository = "https://helm.cilium.io/" | ||
description = "Cilium Add-on" | ||
namespace = "kube-system" | ||
create_namespace = false | ||
|
||
values = [ | ||
<<-EOT | ||
cni: | ||
chainingMode: aws-cni | ||
enableIPv4Masquerade: false | ||
tunnel: disabled | ||
endpointRoutes: | ||
enabled: true | ||
l7Proxy: false | ||
encryption: | ||
enabled: true | ||
type: wireguard | ||
EOT | ||
] | ||
} | ||
} | ||
|
||
tags = local.tags | ||
} |
Oops, something went wrong.