is it possible to create two deployments inside one namespace in K8S?

12/27/2021

I am begginer at K8S, i'm using github actions I have 3 environment (dev, pred-prod, prod) and 3 namespace to each environment, i want to have a second environment (pre-prod-2) into my namespace of pre-production; is it possible ? and how the yaml file will look like ?

Thank you

-- dia
kubernetes
kustomize
skaffold
yaml

1 Answer

12/29/2021

To create another independent deployment in the same namespace, take your existing Deployment YAML and change the following fields:

  • metadata.name
  • spec.selector.matchLabels.app
  • template.metadata.labels.app

It will be sufficient to just append a "2" to each of these values.

-- JWhy
Source: StackOverflow