Hello everyone!
I'm using kubectl-run pipe on the version 1.3.3 to deploy my application to AKS. However I'm facing a problem on setting the application namespace, it's always getting the default namespace no matter what I pass to KUBECTL_ARGS. My pipe configuration looks like this:
- pipe: atlassian/kubectl-run:1.3.3
variables:
KUBE_CONFIG: $KUBE_CONFIG_PRD
KUBECTL_COMMAND: 'apply'
RESOURCE_PATH: 'deploy/WebApi/Deployment.yml'
KUBECTL_ARGS: '--namespace ${ENVIRONMENT}'
No error is shown on logs and actually the pipe executes successfully.
I could see on the source code that the KUBECTL_ARGS are concatenated with the command itself, but as I said on the AKS I'm always getting the default namespace.
This is a very important step to migrate my CI/CD from Jenkins to Bitbucket pipelines, so I really appreciate the help.
Best regards.
To pass such argument to KubeCtl the pipe configuration must be like this:
- pipe: atlassian/kubectl-run:1.3.3
variables:
KUBE_CONFIG: $KUBE_CONFIG
KUBECTL_COMMAND: 'apply'
RESOURCE_PATH: 'deploy/WebApi/Deployment.yml'
KUBECTL_ARGS:
- "--namespace=${ENVIRONMENT}"
Hi @guilherme_silva ,
Thank you for your question!
Please, provide KUBECTL_ARGS as a YAML list, not as a string:
- pipe: atlassian/kubectl-run:1.3.3
variables:
KUBE_CONFIG: $KUBE_CONFIG_PRD
KUBECTL_COMMAND: 'apply'
RESOURCE_PATH: 'deploy/WebApi/Deployment.yml'
KUBECTL_ARGS:
- "--namespace ${ENVIRONMENT}"
We'll investigate this case to prevent such pipe's behavior and notify you.
Cheers,
Oleksandr Kyrdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the quick answer.
I just did the changes that you've suggested and now I'm getting the error bellow:
INFO: Configuring kubeconfig...
Error: unknown flag: --namespace staging
See 'kubectl apply --help' for usage.
✖ kubectl apply failed.
For the record, my pipe now looks like this:
- pipe: atlassian/kubectl-run:1.3.3
variables:
KUBE_CONFIG: $KUBE_CONFIG
KUBECTL_COMMAND: 'apply'
RESOURCE_PATH: 'deploy/WebApi/Deployment.yml'
KUBECTL_ARGS:
- "--namespace ${ENVIRONMENT}"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Oleksandr Kyrdan
I just got what was wrong with the pipe configuration. To pass such argument to KubeCtl the pipe configuration must be like this:
- pipe: atlassian/kubectl-run:1.3.3
variables:
KUBE_CONFIG: $KUBE_CONFIG
KUBECTL_COMMAND: 'apply'
RESOURCE_PATH: 'deploy/WebApi/Deployment.yml'
KUBECTL_ARGS:
- "--namespace=${ENVIRONMENT}"
Thank you for the help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.