Closed sebastian-sommerfeld-io closed 1 day ago
To deploy a demo app like httpd:latest
in your Minikube cluster using ArgoCD, you need to follow these steps:
First, ensure that ArgoCD is installed and running in your Minikube cluster.
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
Wait for ArgoCD to start:
kubectl get pods -n argocd
To access the ArgoCD UI, you need to expose the ArgoCD API server on Minikube.
kubectl port-forward svc/argocd-server -n argocd 8080:443
Access the ArgoCD UI at https://localhost:8080
and login with the default username admin
. You can retrieve the initial password with:
kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 -d
httpd
deployment in a Git repository that ArgoCD will monitor. Here’s an example for a plain Kubernetes manifest setup:# httpd-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd-deployment
labels:
app: httpd
spec:
replicas: 1
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: httpd:latest
ports:
- containerPort: 80
# httpd-service.yaml
apiVersion: v1
kind: Service
metadata:
name: httpd-service
spec:
selector:
app: httpd
ports:
- protocol: TCP
port: 80
targetPort: 80
Push the files to a Git repository, such as GitHub or GitLab.
In the ArgoCD UI or using a CLI, create an ArgoCD Application that will monitor the Git repository containing your app manifests or Helm chart. Here's an example of creating it via a YAML file:
# argocd-app.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: httpd-app
namespace: argocd
spec:
destination:
namespace: default
server: https://kubernetes.default.svc
source:
repoURL: 'https://github.com/your-repo/httpd-demo'
path: 'manifests'
targetRevision: HEAD
project: default
syncPolicy:
automated:
prune: true
selfHeal: true
Apply this file to your ArgoCD namespace:
kubectl apply -f argocd-app.yaml -n argocd
In the ArgoCD UI, locate the httpd-app
and sync it to deploy the httpd
app to your Minikube cluster. You should see the application in the UI.
Alternatively, you can sync via CLI:
argocd app sync httpd-app
To access the deployed httpd
service, you need to expose it. You can either use port-forwarding or Minikube’s service URL:
minikube service httpd-service
This command will open the service in your default web browser.
This setup uses plain Kubernetes manifests, but you can also use Helm charts for more complex applications. Would you prefer a Helm-based setup instead?
ArgoCD Autopilot is an exciting tool that can significantly enhance your experience with ArgoCD, especially in managing and deploying Kubernetes applications. Here are some key aspects and benefits of using ArgoCD Autopilot:
ArgoCD Autopilot is a powerful addition for teams looking to implement GitOps practices effectively. It can greatly reduce the operational burden of managing Kubernetes applications while ensuring consistency and best practices. If your team is adopting ArgoCD, leveraging Autopilot can enhance your workflow and help you get the most out of your GitOps implementation.
If you're considering using ArgoCD Autopilot, I'd be happy to help with the setup or any specific questions you might have!
To start using ArgoCD Autopilot in your Minikube setup, follow these steps:
First, ensure you have the ArgoCD Autopilot CLI installed. You can download the latest version from the ArgoCD Autopilot GitHub releases page.
For example, on a Unix-like system, you can install it using:
curl -sSL https://github.com/argoproj-labs/argocd-autopilot/releases/latest/download/argocd-autopilot-linux-amd64 -o argocd-autopilot
chmod +x argocd-autopilot
sudo mv argocd-autopilot /usr/local/bin/
Create a Git repository for your applications. This repository will store your application configurations managed by ArgoCD Autopilot. You might structure it like this:
your-git-repo/
├── apps/
│ └── httpd/
│ ├── app.yaml
│ └── ...
├── clusters/
│ └── minikube/
│ ├── app.yaml
│ └── ...
└── README.md
Navigate to your repository's root directory and initialize ArgoCD Autopilot:
cd your-git-repo
argocd-autopilot init
This command creates the necessary files and directories for managing your applications.
Create a new application (e.g., for httpd
) using Autopilot. Run the following command:
argocd-autopilot app create httpd \
--repo your-git-repo-url \
--path apps/httpd \
--dest-namespace default \
--dest-server https://kubernetes.default.svc
your-git-repo-url
with your actual Git repository URL.apps/httpd/app.yaml
.Edit apps/httpd/app.yaml
to define your httpd
application. Here's a simple example for an HTTPD deployment:
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd
labels:
app: httpd
spec:
replicas: 1
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: httpd:latest
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: httpd
spec:
selector:
app: httpd
ports:
- protocol: TCP
port: 80
targetPort: 80
Once you have configured your application, commit and push your changes to your Git repository:
git add .
git commit -m "Add httpd application"
git push origin main
You need to add your Git repository to ArgoCD so it can monitor your applications:
argocd repo add your-git-repo-url --username <username> --password <password>
Now, you can create the application in ArgoCD using the following command:
argocd app create httpd \
--repo your-git-repo-url \
--path apps/httpd \
--dest-namespace default \
--dest-server https://kubernetes.default.svc
To sync the application, run:
argocd app sync httpd
To access the httpd
service, you can use the Minikube service command:
minikube service httpd
This will open the service in your default web browser.
httpd
.With these steps, you should be able to set up ArgoCD Autopilot in your Minikube environment effectively. If you have any specific configurations or adjustments in mind, let me know!
To set up a playground for ArgoCD with Minikube and keep the ArgoCD configuration in a repository containing Helm scripts and the ArgoCD config, here's how I would start:
minikube start --driver=your-preferred-driver
kubectl config use-context minikube
argocd-playground
). helm repo add argo https://argoproj.github.io/argo-helm
helm repo update
helm/
folder in your repo and a values.yaml
file for ArgoCD custom configuration:
# helm/argocd/values.yaml
server:
service:
type: NodePort # Or LoadBalancer if using cloud or external access
ingress:
enabled: true # If you want to expose ArgoCD via ingress
hosts:
- argocd.local
helm install argocd argo/argo-cd -f helm/argocd/values.yaml -n argocd --create-namespace
argocd/
folder to contain ArgoCD configuration manifests. argocd-playground/
├── helm/
│ └── argocd/
│ └── values.yaml
├── argocd/
│ ├── projects/
│ ├── apps/
│ ├── repositories/
│ └── clusters/
└── README.adoc
argocd/projects/sample-project.yaml
:
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: sample-project
namespace: argocd
spec:
description: "Sample ArgoCD project"
sourceRepos:
- '*'
destinations:
- namespace: '*'
server: '*'
argocd/apps/
. argocd repo add https://github.com/yourusername/argocd-playground --username <user> --password <password>
argocd
CLI to sync them:
argocd app create sample-app --repo https://github.com/yourusername/argocd-playground --path argocd/apps/sample-app --dest-namespace default --dest-server https://kubernetes.default.svc
auto-sync
feature:
spec:
syncPolicy:
automated:
prune: true
selfHeal: true
kubectl port-forward svc/argocd-server -n argocd 8080:443
admin
, password: the initial password can be retrieved with:
kubectl get secret argocd-initial-admin-secret -n argocd -o jsonpath="{.data.password}" | base64 -d
Now you can start experimenting with ArgoCD in your Minikube environment, managing deployments using the configuration stored in your Git repository.
Relates to #18
Automate deployments so they react to changes automatically (through gitops). Scaling should be done automatically as well as updating a version. Move from helm to ArgoCD for this. Just deploy ArgoCD with
helm
as part of theadmin-charts
configs-homelab/components/minikube/argocd-config
-> the ArgoCD config itseltconfigs-homelab/components/minikube/manifests
-> The deployment manifests which Argo watches (helm charts)docs/minikube.md