I'm trying to configure AWS EKS & Fargate. By default, the CoreDNS add-on is configured to run on EC2 nodes hence I have to remove it (annotation) so that Fargate (worker node) can pick it up, this step is officially stated here. This whole thing should be automated using Terraform. The said step can be achieved using Terraform's Kubernetes provider. However, I can't find any article/doc saying how to target certain values in ignore_annotations.
On the EKS & Fargate doc, it says I have to run the ff command to remove annotation:
kubectl patch deployment coredns \
-n kube-system \
--type json \
-p='[{"op": "remove", "path": "/spec/template/metadata/annotations/eks.amazonaws.com~1compute-type"}]'
and in the Terraform Kubernetes provider doc, the configuration should look like the ff:
provider "kubernetes" {
ignore_annotations = [
"^service\\.beta\\.kubernetes\\.io\\/aws-load-balancer.*",
]
}
I tried the ff configuration but it didn't work (annotation is not removed):
provider "kubernetes" {
host = module.eks.cluster_endpoint
cluster_ca_certificate = module.eks.cluster_certificate_authority_data
exec {
api_version = "client.authentication.k8s.io/v1alpha1"
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]
command = "aws"
}
ignore_annotations = [
"eks\\.amazonaws\\.com\\/compute-type",
]
}
perhaps I have the ignore_annotations value wrong?