Deploy application using Flux CD
Deploy application using Flux CD
monitoring your source code repository for changes and automatically generating
Flux manages deployments using the GitOps concept, which implies that your application’s
desired state is stated in source code and version-controlled using Git. This method makes it
simple to track deployment modifications and collaborate with other team members.
GitOps:
GitOps is a method of managing your infrastructure and apps in such a way that the entire
system is described declaratively and version controlled (most likely in a Git repository), with
an automated mechanism ensuring that the deployed environment matches the state
Pre-Requisites:
unzip awscliv2.zip
sudo ./aws/install
Okay now after installing the AWS CLI, let's configure the AWS CLI so that it can
authenticate and communicate with the AWS environment.
aws configure
Install and Setup Kubectl
Moving forward now we need to set up the kubectl also onto the EC2 instance.
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin
kubectl version
terraform apply
aws eks --region ap-south-1 update-kubeconfig --name eks_cluster_demo
Install Flux
https://www.webagesolutions.com/blog/deploy-an-application-using-flux
Bootstrap Flux
Then, run the following command to have Flux check your cluster to see if it meets the
To begin, export your GitHub credentials to your terminal so that Flux may use them
1. In the upper-right corner of any page, click your profile photo, then click Settings.
2. In the left sidebar, click Developer settings.
3. In the left sidebar, click Personal access tokens -> Token(Classic) ->Generate
New token.
5. Then give name, select expiration date, Select scope as per your
requirement and generate token
6. Copy the token and save in secure place. We cant get the same key
again.
Parameter Explanation
–
The name of the Git repo that will be created.
repository
A folder in the repo where the config files will be added. This
–path option lets you store the files for multiple clusters in the
same repo.
Kubectl get ns
kubectl get all -n flux-system
cd blue-green/blue
the GitHub repository and leaving the rest to Flux CD. Flux CD should automatically
retrieve and apply updated resource definitions from the repository to the cluster.
Let’s have a look at the repository and add some more resource definitions to it.
We will now tell where our application’s “kustomization” files are
located.
In the flux-doc repo, go inside the clusters/my-cluster folder:
cd flux-doc/clusters/my-cluster/flux-system
If you wish to use the CLI, run the two commands below to generate the YAML
cd flux-doc/clusters/my-cluster
Now I have build new docker image and pushed to docker hub and used
that new image in deployment file in our app repository. Automatically
application deployed.
To uninstall flux: