Argo CD & OpenFaaS
Using quickstart from Argo CD and learning guide from Civo we can install ArgoCD easily:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
After that we can access it by forwarding port:
kubectl port-forward svc/argocd-server -n argocd 8080:443
Password for admin user we can get from:
kubectl get pods -n argocd -l app.kubernetes.io/name=argocd-server -o name | cut -d'/' -f 2
After that we can add repository e.g. for OpenFaaS: https://github.com/openfaas/faas-netes
Then install OpenFaaS:
kubectl apply -f https://raw.githubusercontent.com/openfaas/faas-netes/master/namespaces.yml
Configure password:
PASSWORD=$(head -c 12 /dev/urandom | shasum| cut -d' ' -f1)
kubectl -n openfaas create secret generic basic-auth --from-literal=basic-auth-user=admin \
--from-literal=basic-auth-password="$PASSWORD"
To decode password in future we can use:
kubectl -n openfaas get secrets/basic-auth -o json | jq '.data | map_values(@base64d)'
In ArgoCD configure new application using YAML:
apiVersion: argoproj.io/v1alpha1
metadata:
name: openfaas
spec:
destination:
namespace: openfaas
server: 'https://kubernetes.default.svc'
source:
path: chart/openfaas
repoURL: 'https://github.com/openfaas/faas-netes'
targetRevision: HEAD
helm:
valueFiles:
- values.yaml
project: default
syncPolicy:
automated:
prune: false
selfHeal: true
At the end we configure Ingress controller:
kubectl apply -f ingress-open-faas.yaml
with file ingress-open-faas.yaml
:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: openfaas-ingress
namespace: openfaas
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: openfaas.67de4b54-70c1-46a2-88d1-6676a2bd7768.k8s.civo.com
http:
paths:
- path: /
backend:
serviceName: gateway
servicePort: 8080