Hallo Habr. Im Rahmen des Kurses "Infrastrukturplattform basierend auf Kubernetes" haben wir eine Übersetzung von nützlichem Material für Sie vorbereitet.
Wir laden Sie auch zum offenen Webinar "Arbeiten mit NoSQL-Datenbanken in k8s (am Beispiel von Apache Cassandra)" ein . Während des Webinars werden die Teilnehmer zusammen mit einem Experten die Vor- und Nachteile der Ausführung von Apache Cassandra in k8s erörtern: Wie bereit diese Installationsoption für die Produktion ist und welche Fallstricke es gibt.
In diesem Artikel werden einige Fragen zu Argo CD behandelt: Was ist es, warum wird es verwendet, wie wird es bereitgestellt (in Kubernetes), wie wird es zur Implementierung einer kontinuierlichen Bereitstellung verwendet, wie wird SSO mit GitHub und Berechtigungen konfiguriert usw. usw. usw.
Was ist Argo CD und GitOps?
Argo CD — GitOps- (continuous delivery) Kubernetes.
GitOps?
, GitOps — (continuous deployment) . , , Git Continuous Deployment.
, ? , , , , : K8s YAML Helm-, Git (single source of truth), CI , master , .
GitOps
, .
() :
, . , git ; ; , ; , .
GitOps , .
Argo CD
GitOps, CI/CD? , . , Jenkins, , Git- , git clone helm install. Jenkins, CI: CI: 17 CI CI 2020 .
, , , .
, Argo CD , : , , , , , , .
, , , , :
Cloud Native Computing Foundation (CNCF).
. :
git- , :
v0.1.0 2018 ( )
v1.0.0 2019 ( )
v1.7.8 ( 2020, )
4,3 . Argo CD ( )
60 PR 500 ( , , )
CNCF:
«» (ASSESS), , CNCF , . , .
CNCF End User Community. 140 , . , , , , , , , . , , .
, . K8s, k8s.
kubectl create namespace argocd
kubectl apply -n argocd -f \
https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
YAML, .
. :
Pods:
argocd-application-controller-6b47c9bd78-kp6dj
argocd-dex-server-7b6d8776d8-knsxx
argocd-redis-99fb49846-l466k
argocd-repo-server-b664bd94b-bmtwr
argocd-server-768879948c-sx875
Services:
argocd-dex-server
argocd-metrics
argocd-redis
argocd-repo-server
argocd-server
argocd-server-metrics
ingress:
, Cluster IP, ingress . , , , , ingress.
, EKS AWS, , ingress , , ingress-. Argo CD , 443 HTTPS ( - ), GRPC API . EKS, , ingress- Nginx, , TLS , ingress- , HTTP, GRPC. .
CLI
Mac :
brew install argocd
. :
argocd login ( , , ingress - )
:
argocd account update-password
, :
Argo CD
Argo CD, , , dev, test, staging, production - .
, Argo CD, Argo CD:
:
argocd cluster list
, :
argocd cluster add CONTEXTNAME
«CONTEXTNAME»- kube .
Helloworld-
«» Argo CD.
«TL;DR» « UI» — :
argocd app create helloworld --repo https://github.com/ironcore864/go-hello-http.git --path helm --sync-policy automatic --dest-server https://kubernetes.default.svc --dest-namespace default --values values.yaml --values values.dev.yaml
CLI- , . Argo CD, , :
«NEW APP» :
, :
Application Name: . «helloworld»
Project: «default». Project () — Argo CD,
Sync policy: Manual Automatic ( GitOps). Automatic ( , — «Manual»).
«SYNC POLICY» «Automatic»
SOURCE . URL- git. , . , , , Golang «helm», .
, URL- git-, «PATH», , Argo CD , «helm» , , :
«Path» «helm» .
, «Path» «helm».
, Argo CD . Argo CD ; YAML k8s, kustomize, helm. , «Path» , Argo CD , Helm; YAML k8s, Argo CD , kubectl apply. , ?
«Destination» , Kubernetes ( ) ( ).
«URL- », .
«helm» , Argo CD «Helm», , , :
«VALUES FILES», , «Path», .
, . helm — , , CLI-.
, , dev , , , .
«Create» Argo CD «» (sync) , git-, , git, Argo CD , git. , , :
, 1 ( «values.dev.yaml» 3 , «values.yaml»), , . , , :
, . 1 , bash- cd - , helm, , , helm, .
CLI-, , , , .
GitHub SSO
, , — , , .
Argo CD , . , SSO-.
Argo CD, , , SSO.
Argo CD Dex . (OIDC, SAML, LDAP, GitHub . .). (SSO) Argo CD argocd-cm Dex-. OAuth git configmap «argocd-cm», :
data:
url: https://argocd.example.com
dex.config: |
connectors:
# GitHub example
- type: github
id: github
name: GitHub
config:
clientID: aabbccddeeff00112233
clientSecret: $dex.github.clientSecret
orgs:
- name: your-github-org
# GitHub enterprise example
- type: github
id: acme-github
name: Acme GitHub
config:
hostName: github.acme.com
clientID: abcdefghijklmnopqrst
clientSecret: $dex.acme.clientSecret
orgs:
- name: your-github-org
, GitHub SSO .
GitHub SSO , , — - RBAC, Argo CD. , SSO, RBAC, configmap argocd-rbac-cm
:
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-rbac-cm
namespace: argocd
data:
policy.default: role:readonly
policy.csv: |
p, role:org-admin, applications, *, */*, allow
p, role:org-admin, clusters, get, *, allow
p, role:org-admin, repositories, get, *, allow
p, role:org-admin, repositories, create, *, allow
p, role:org-admin, repositories, update, *, allow
p, role:org-admin, repositories, delete, *, allow
g, your-github-org:your-team, role:org-admin
, , GitHub, .
, , (, SSO, , RBAC), ( , ) . , . , , .
« NoSQL k8s ( Apache Cassandra)».