Is there a way to inherit annotations to all resources in a namespace? My naive assumption was that I can annontate the namespace and that resources will get this annontation:
kubectl get --export namespaces non-native -o yaml
apiVersion: v1
kind: Namespace
metadata:
annotations:
foo: bar
creationTimestamp: null
name: non-native
selfLink: /api/v1/namespaces/non-native
spec:
finalizers:
- kubernetes
status:
phase: Active
Running
kubectl get --export pod -n non-native nginx-6f858d4d45-s2xzl -o yaml
shows no foo=bar
annotations.
Am I asking for the impossible? Can you achieve this?
Although my example shows a Pod, I would like to annotate also other resources, like services, or PVCs etc.
I think podpreset
can help
kind: PodPreset
apiVersion: settings.k8s.io/v1alpha1
metadata:
annotations:
foo: bar
namespace: {youNamespace}
How enable PodPreset:
settings.k8s.io/v1alpha1/podpreset