Use of helm in bitbucket pipeline using custom chart
Asked by Pritam Amin:

Hello Bitbucket Community,

I am using the custom helm chart and wanted to deploy it to the private AKS AAD enabled cluster using the bitbucket pipeline.

<br />

I am trying to use the invoke command to run it by using the variables;

- HELM_UPGRADE_COMMAND="helm upgrade $HELM_CHART_NAME /opt/atlassian/pipelines/agent/build/charts/xxxx --namespace $NAMESPACE --set=image.tag=0.0.1-xxxx --wait --install"  
- az aks command invoke --resource-group "$DEV_RESOURCE_GROUP" --name "$DEV_AKS_NAME" --command "$HELM_UPGRADE_COMMAND"  
**`+ az aks command invoke --resource-group "$DEV_RESOURCE_GROUP" --name "$DEV_AKS_NAME" --command "$HELM_UPGRADE_COMMAND"`**   
**`Error: path "/opt/atlassian/pipelines/agent/build/charts/xxxx" not found`**  
If I am directly passing the helm command using the invoke command then getting following error;  
**`+ az aks command invoke --resource-group "$DEV_RESOURCE_GROUP" --name "$DEV_AKS_NAME" --command "helm upgrade $HELM_CHART_NAME /opt/atlassian/pipelines/agent/build/charts/xxxx --namespace $NAMESPACE --set=image.tag=0.0.1-xxxx --wait --install"`
`ERROR: (KubernetesOperationError) Failed to run command in managed cluster due to kubernetes failure. details: Get "`[https://x.x.x.x:443/api/v1/namespaces/aks-command/pods/command-xxxx](https://20.197.71.241/api/v1/namespaces/aks-command/pods/command-d8a7b76f212242b1a5191e4983c4596d)`": net/http: TLS handshake timeout`
`Code: KubernetesOperationError`
`Message: Failed to run command in managed cluster due to kubernetes failure. details: Get "`[https://x.x.x.x:443/api/v1/namespaces/aks-command/pods/command-xxxx](https://20.197.71.241/api/v1/namespaces/aks-command/pods/command-d8a7b76f212242b1a5191e4983c4596d)`": net/http: TLS handshake timeout`**  
**Note: I am able to get the cluster info using the kubectl command. Only helm chart path is not able to fetch.**  
If you have any resolutions or alternatives/workarounds to resolve this please update as it will be highly appreciated!!  
Thank you!!


Answers:
author: Patrik S
body: Hello [@Pritam Amin](/t5/user/viewprofilepage/user-id/5363260) and welcome to the Community!

I'm not very familiar with AKS helm deployments, but our development team has created a bitbucket pipe that simplifies helm deployments to AKS when using pipelines, which you can check below :

* [atlassian/azure-aks-helm-deploy](https://bitbucket.org/product/features/pipelines/integrations?search=helm&p=atlassian/azure-aks-helm-deploy)

I would suggest taking a look at that pipe's documentation as it contains multiple examples of configuration and what needs to be setup on the Azure side as well, so you can use it as a base for setting up your pipelines for helm deployments.

Thank you, [@Pritam Amin](/t5/user/viewprofilepage/user-id/5363260) !

Patrik S

comments: author: Pritam Amin
body: Hi [@Patrik S](/t5/user/viewprofilepage/user-id/4603309) ,  

Thank you for your response!!  

As this is method will work for AAD enable cluster but not for private AKS.

Is there any alternative workaround for the private AKS with AAD enabled cluster?

Thanks!!


author: Patrik S
body: Hello [@Pritam Amin](/t5/user/viewprofilepage/user-id/5363260) ,

From the error being returned "**`TLS handshake timeout`**" it seems like pipelines are not able to connect to the AKS instance, likely because it's set to private. The resource you are trying to access needs to be available on the internet so Pipelines can access it.

One thing I can suggest is that if AKS applies any sort of firewall in front of your instance, you might need to allow the [Bitbucket Pipelines IP addresses](https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/#Valid-IP-addresses-for-Bitbucket-Pipelines-build-environments). If that also does not work, I would recommend reaching out to Azure support to get assistance on how to configure the AKS instance to accept external requests from the internet coming from the Pipelines IPs.

Thank you, [@Pritam Amin](/t5/user/viewprofilepage/user-id/5363260) !

Patrik S


Tags: bitbucket-cloud

bitbucket-pipelines

cloud