Skip to content
Using Flux, a GitOps Tool, with Amazon Elastic Kubernetes Service (EKS) - Part 2

This is the second part of the series on Using Flux, a GitOps Tool, with Amazon Elastic Kubernetes Service (EKS). The first article discussed what GitOps and Flux are, what technologies we will use, the prerequisites and architecture overview, and the configuration and setup process.

In this part two article, we will be working on these tasks.

  • Configure access to Amazon EKS Cluster
  • Build and push Docker image to Amazon ECR
  • Install GitOps and Flux CLI Tools
  • Review script to configure Flux Repository
  • Install Flux to the Amazon EKS Cluster

You can access all of the code used in my GitHub Repository.

Configure access to Amazon EKS Cluster

Amazon EKS Cluster details can be extracted from terraform output or by accessing the AWS Console to get the name of the cluster. This following command can be used to update the kubeconfig in your local machine where you run kubectl commands to interact with your EKS Cluster. Navigate to the root of the directory of the GitHub repo and run the following commands:

cd terraform



AWS_REGION=$(terraform output -raw aws_region)

EKS_CLUSTER_NAME=$(terraform output -raw eks_cluster_name)

aws eks --region $AWS_REGION update-kubeconfig --name $EKS_CLUSTER_NAME

Results of configuring kubeconfig.

Create and Push Docker Image to Amazon ECR

Build the Docker Image

Set the variables needed to build and push your Docker image. Navigate to the root of the directory of the GitHub repo and run the following commands:

cd terraform



AWS_REGION=$(terraform output -raw aws_region)

ECR_REPO=$(terraform output -raw ecr_repo_url)

To build the Docker image, run the following command:

cd ..



docker build --platform linux/amd64 --no-cache --pull -t ${ECR_REPO}:latest ./react-app

Push the Docker Image to Amazon ECR

To push the Docker image to Amazon ECR, authenticate to your private Amazon ECR registry. To do this, run the following command:

aws ecr get-login-password --region $AWS_REGION 
                    

Related Articles

Inter-Region WireGuard VPN in AWS

Read more

Making PDFs Searchable Using AWS Textract and CloudSearch

Read more

Slack AI Bot with AWS Bedrock Part 2

Read more

Contact Us

Achieve a competitive advantage through BSC data analytics and cloud solutions.

Contact Us