Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Labeling default namespaces, pods, and deployment templates #2585

Open
KyleKotowick opened this issue Sep 12, 2024 · 1 comment
Open

Labeling default namespaces, pods, and deployment templates #2585

KyleKotowick opened this issue Sep 12, 2024 · 1 comment
Assignees
Labels

Comments

@KyleKotowick
Copy link

Terraform version, Kubernetes provider version and Kubernetes version

Terraform version: 1.9.5
Kubernetes Provider version: 2.32.0
Kubernetes version: 1.29.7

Question

I need to apply labels to the default namespace (kube-system), pods, and deployment templates that are automatically created for DNS in an Azure AKS cluster.

Through kubectl, I would do this like so:

kubectl label ns kube-system mylabel=myvalue
kubectl label pods -n kube-system coredns-... mylabel=myvalue
kubectl -n kube-system patch deployment coredns --patch '{"spec": {"template": {"metadata": {"labels": {"mylabel": "myvalue"}}}}}'

While these modifications can be done to new namespaces/pods/deployments created through Terraform resources, I cannot find a way to make these changes to existing default namespaces/pods/deployments. Is this possible? Preferably, a solution would avoid import blocks so that other existing configuration options aren't overwritten/deleted when the imported resource is applied.

@alexsomesan
Copy link
Member

@KyleKotowick Have you had a look at the kubernetes_labels resource? I believe this is what you are looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants