testing argocd with minikube

get ready

#minikube delete --all
minikube start --driver=docker --container-runtime=containerd
    minikube addons enable ingress

install argocd

same host kubectl

as mentioned in the guide

kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml

https://github.com/argoproj/argo-cd/releases/latest
https://argo-cd.readthedocs.io/en/stable/cli_installation/

#kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "NodePort"}}'
kubectl get svc -o wide -n argocd | grep NodePort

you need to login first

argocd admin initial-password -n argocd
#argocd account update-password
#argocd login minikube
argocd login --core

prepare manifests

remote machine

create a github repo e.g.

test-argocd

grab

git clone git@github.com:pbraun9/test-argocd.git
cd test-argocd/

with this content (--path requires dedicated folders per project to deploy)

mkdir test-app/
cd test-app/
vi test-app-deploy.yml

apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-app
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: test-app
  template:
    metadata:
      labels:
    app: test-app
    spec:
      containers:
      - image: gcr.io/google-samples/hello-app:1.0
    name: test-app
    ports:
    - containerPort: 8080

note clusterip might have been enough, as we also point ingress towards test-app above

vi test-app-svc-nodeport.yml

apiVersion: v1
kind: Service
metadata:
  name: test-app
spec:
  type: NodePort
  ports:
  - port: 8080
    targetPort: 8080
  selector:
    app: test-app

not sure why we we had to force the nodeport once, now works dynamically

    #nodePort: 30007

ingress

vi test-app-svc-ingress.yml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: test-app
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - host: hello-world.info
      http:
    paths:
      - path: /
        pathType: Prefix
        backend:
          service:
        name: test-app
        port:
          number: 8080

git commit -a
git push

deploy the test app

kubectl config set-context --current --namespace=argocd

#argocd app delete test-app
argocd app create test-app \
    --repo https://github.com/pbraun9/test-argocd.git \
    --path test-app \
    --dest-server https://kubernetes.default.svc \
    --dest-namespace default

in case you made conflicting changes

--upsert

find the service to tunnel (assuming remote minikube system)

minikube service list

# argocd http redirects to https
#ssh minikube -L 8080:192.168.49.2:30065

# argocd https
ssh minikube -L 8443:192.168.49.2:31989

reach the UI

https://localhost:8443/

(login and sync test-app)

check

kubectl config set-context --current --namespace=default
kubectl get deploy
kubectl get pods
kubectl get svc
kubectl get ingress

# nodeport (optional)
minikube service test-app --url
curl -i http://192.168.49.2:32234

# ingress
    curl --resolve hello-world.info:80:192.168.49.2 -i http://hello-world.info

resources

install

https://argo-cd.readthedocs.io/en/stable/getting_started/

https://argo-cd.readthedocs.io/en/stable/operator-manual/ingress/ ==> serve argocd with ingress

apps

https://github.com/argoproj/argocd-example-apps/tree/master/guestbook

usage

https://www.shellhacks.com/argocd-use-upsert-flag-to-force-update/

troubles

https://stackoverflow.com/questions/69245492/where-do-i-put-my-nodeport-spec-in-my-deployment-yaml ==> force nodeport

https://stackoverflow.com/questions/75488142/troubleshooting-ingress-stuck-in-progressing-state-in-argocd ==> enable ingress plugin

https://github.com/argoproj/argo-cd/issues/4863#issuecomment-1400786602 ==> enable ingress plugin


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2023 Pierre-Philipp Braun