Introduction to Argo CD Kubernetes DevOps CI/CD
Делаю:
09.05.2023
04 - Argo CD Deep Dive
12 - Deploying a sample application to Argo CD
// $ argocd repo add "https://gitlab.com/abohmeed/samplegitopsapp.git" --username " [your username]" --password "[your personal token]"
$ kubectl create ns microservices-demo
$ cat << EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: microservices-demo
namespace: argocd
spec:
project: default
source:
repoURL: 'https://github.com/GoogleCloudPlatform/microservices-demo.git'
path: kustomize
targetRevision: main
destination:
server: 'https://kubernetes.default.svc'
namespace: microservices-demo
syncPolicy:
automated:
selfHeal: true
prune: true
EOF
$ argocd app sync microservices-demo
$ kubectl get svc,pod -o wide -n microservices-demo
$ kubectl -n microservices-demo port-forward svc/frontend-external 31801:80
// OK!
http://localhost:31801/
13 - Deploying Helm charts to Argo CD
$ kubectl create ns helm-example
$ cat << EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: httpbin
namespace: argocd
spec:
project: default
source:
chart: httpbin
repoURL: https://matheusfm.dev/charts
targetRevision: 0.1.1
helm:
releaseName: httpbin
values: |
service:
type: NodePort
destination:
server: 'https://kubernetes.default.svc'
namespace: helm-example
syncPolicy:
automated:
selfHeal: true
prune: true
EOF
$ kubectl get svc -n helm-example
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
httpbin NodePort 10.98.5.177 <none> 80:31473/TCP 8m46s
$ helm create httpd
# values.yaml
image:
repository: httpd
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: latest
$ helm package .
Get the project ID from Gitlab by going to the project page and clicking on settings. Copy the ID.
$ curl --request POST --form '[email protected]' --user "[your username]:[your
token]" https://gitlab.com/api/v4/projects/[your project id]/packages/helm/api/stable/charts
$ argocd repocreds add https://gitlab.com/api/v4/projects/[your project id]/packages/helm/stable --username [your username] --password [your personal token]
$ cat << EOF > busybox.yaml
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: httpd
namespace: argocd
spec:
project: default
source:
chart: httpd
repoURL: https://gitlab.com/api/v4/projects/[project id]/packages/helm/stable
targetRevision: 0.1.0
helm:
releaseName: httpd
destination:
server: 'https://kubernetes.default.svc'
namespace: helm-example2
syncPolicy:
automated:
selfHeal: true
prune: true
EOF