jenkinsslave

how to define name space to deploy except default namespace when using kubernetes continuous deploy plugin


I haven't any clue for how to give the specific namespace where I want to deploy my app kubernetesDeploy(kubeconfigId: 'test', configs: "test.yml")

I am slave in one cluster and need to deploy in another cluster. The deployment always goes to the default namespace

Image here


Solution

  • You can set namespace as parametric to take parameter from pipeline;

    yml;

    namespace: ${PIPELINE_NAMESPACE}
    

    Pipeline;

    env.PIPELINE_NAMESPACE = "test"
    kubernetesDeploy(kubeconfigId: 'test', configs: "test.yml")