I've a simple project that use kustomize like this:
base/
namespace.yaml
kustomization.yaml
service.yaml
With kustomization.yaml
is:
resources:
- namespace.yaml
- service.yaml
namespace: my_wanted_namespace
And namespace.yaml
is:
apiVersion: v1
kind: Namespace
metadata:
name: default
The problem is that when I do: kustomize build ./base
I've this:
apiVersion: v1
kind: Namespace
metadata:
name: default
How can I have
apiVersion: v1
kind: Namespace
metadata:
name: my_wanted_namespace
Thanks.
If you want to create your namespace with kustomize, your kustomize file should look like this. It has to use the namespace.
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: my-wanted-namespace
resources:
- ./namespace.yml
And your namespace file should be a normal namespace deployment like this:
apiVersion: v1
kind: Namespace
metadata:
name: my-wanted-namespace
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With