Is there a way to deploy a image from bitbucket pipeline into EKS cluster with private endpoint?
Asked by kudupudi.kumar:

I have configured a bitbucket.yaml pipeline where I have passed the kube_token to authenticate and deployed the build image into EKS cluster. This happens EKS cluster with public endpoint. Where as I want to secure my cluster by enabling the private endpoint. When I changed my endpoint from public to private endpoint, the existing pipeline was unable to authenticate with cluster to deploy the new image. Is there a way to deploy an image from bitbucket pipeline into private endpoint eks cluster?


Answers:
author: Patrik S
body: Hello [@kudupudi.kumar](/t5/user/viewprofilepage/user-id/5336110) and welcome to the Community!

According to [AWS EKS official documentation](https://docs.aws.amazon.com/eks/latest/userguide/cluster-endpoint.html#modify-endpoint-access), when only a private endpoint is enabled in an EKS cluster, all traffic to your cluster API server must come from within your cluster's VPC or a [connected network](https://docs.aws.amazon.com/whitepapers/latest/aws-vpc-connectivity-options/introduction.html). Since the Bitbucket Cloud pipelines network will not be in the same VPC as your AWS EKS cluster, I'm afraid you will not be able to access the EKS resource from the pipeline.

You would still need to have a public endpoint enabled on your EKS cluster so pipelines can access it over the internet. In order to improve the security of your cluster, you can limit the CIDR IP blocks that can access the public endpoint allowing access only to the [Valid IP addresses for Bitbucket Pipelines](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).

Thank you, [@kudupudi.kumar](/t5/user/viewprofilepage/user-id/5336110) !

Patrik S

comments: author: kudupudi.kumar
body: Hi [@Patrik S](https://community.atlassian.com/t5/user/viewprofilepage/user-id/4603309)

Thanks for the quick reply.

I heard about BitBucket runners. Can I configure the runner in the VPC where my EKS cluster resides?

Thank you

KK


author: Patrik S
body: Hello [@kudupudi.kumar](/t5/user/viewprofilepage/user-id/5336110) ,

You should be able to run a [Self-hosted Linux Docker runner](https://support.atlassian.com/bitbucket-cloud/docs/set-up-and-use-runners-for-linux/) in an EC2 instance, for example, that is in the same VPC as your EKS cluster, which would in theory allow you to connect to your EKS cluster with only private endpoint enabled.

Thank you, [@kudupudi.kumar](/t5/user/viewprofilepage/user-id/5336110) .

Patrik S


author: kudupudi.kumar
body: Thank you [@Patrik S](/t5/user/viewprofilepage/user-id/4603309)

I will follow the steps in the document to create a self hosted runner in the same VPC .

Thank you


author: kudupudi.kumar
body: Hi [@Patrik S](/t5/user/viewprofilepage/user-id/4603309)

Thanks for the quick reply.

I heard about BitBucket runners. Can I configure the runner in the VPC where my EKS cluster resides?

Thank you

KK


Tags: aws

bitbucket-cloud

bitbucket-pipelines

cloud

kubernetes