GitOps with Helm and Argo CD
Argo CD: Deploying an Application
We will use the eon01/argocd-helm-example GitHub repository to deploy a basic Flask application on our Kubernetes cluster using Argo CD. It includes examples of applications deployable with Argo CD, each stored in a distinct folder.
We can now deploy the application manifest using the following command:
argocd app create flask-app \
--repo https://github.com/eon01/argocd-helm-example/ \
--path flask-app \
--dest-server https://kubernetes.default.svc \
--dest-namespace flask-app \
--revision main \
--sync-policy automated \
--sync-option CreateNamespace=true
The above command will create an Application named flask-app using the manifest stored in the flask-app folder of the GitHub repository.
ℹ️ Application is the name of the CRD that Argo CD uses to represent a deployable unit. It is not to be confused with a regular application, but it is a "wrapper" around your application that Argo CD understands and manages.
The app will be deployed in the flask-app namespace of the Kubernetes cluster. The main branch is used. We are using the --sync-policy automated flag to enable automated synchronization.
The automated synchronization will continuously ensure that the Kubernetes cluster reflects the desired application state defined in the Git repository. If the actual state of the application differs from the desired state, the application will be automatically synchronized. The synchronization is performed every 3 minutes by default. This can be customized.
The flask-app folder contains a kubernetes.yaml file that defines the Deployment and Service resources required to deploy the application.
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: flask-app
spec:
replicas: 1
revisionHistoryLimit: 3
selector:
matchLabels:
app: flask-app
template:
metadata:
labels:
app: flask-app
spec:
containers:
- image: eon01/stateless-flask:v0
name: flask-app
ports:
- containerPort: 5000
resources:Helm in Practice
Designing, Deploying, and Operating Kubernetes Applications at ScaleEnroll now to unlock current content and receive all future updates for free. Your purchase supports the author and fuels the creation of more exciting content. Act fast, as the price will rise as the course nears completion!
Hurry! This limited time offer ends in:
To redeem this offer, copy the coupon code below and apply it at checkout:
