inject/pass value to a parameter in kube manifest file

4/16/2020

This is a very simple thing I am trying to do. I have the below kube manifest file that creates a namespace.

test-ns.yml

apiVersion: v1
kind: Namespace
metadata:
  name: ${NAMESPACE}

all i am trying to do is kubectl apply -f test-ns.yml --namespace=test

This the error I am getting

The Namespace "${NAMESPACE}" is invalid: metadata.name: Invalid value: "${NAMESPACE}": a DNS-1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')

I am not sure how to pass the NAMESPACE value to the kube manifest file. What am I doing wrong here? and how should I be doing this?

-- vkr
kubectl
kubernetes

0 Answers