新聞中心
argo云原生簡介
Argo CD 是一個開源的持續(xù)交付工具,用于在 Kubernetes 集群中實現(xiàn) CI/CD,它可以幫助開發(fā)人員自動化應用程序的構建、測試和部署過程,從而提高生產(chǎn)力,Argo CD 支持多種源代碼管理工具,如 Git、GitHub、GitLab 等,以及多種持續(xù)集成/持續(xù)部署(CI/CD)平臺,如 Jenkins、Travis CI、CircleCI 等,Argo CD 使用 Helm 作為包管理器,可以輕松地將應用程序打包并部署到 Kubernetes 集群中。

安裝與配置 Argo CD
1、安裝 Helm
需要在計算機上安裝 Helm,Helm 是 Kubernetes 的一個包管理器,用于管理 Kubernetes 應用程序的依賴關系,可以通過以下命令安裝 Helm:
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
2、添加 Argo CD 倉庫
接下來,需要添加 Argo CD 倉庫,以便從中獲取 Argo CD 的 Helm chart,可以通過以下命令添加倉庫:
helm repo add argocd https://argoproj.github.io/argo-cd helm repo update
3、安裝 Argo CD
通過以下命令安裝 Argo CD:
helm install my-argocd argocd/argo-cd --version v0.7.0 --create-namespace --namespace argocd --set git.url=https://github.com/my-repo.git,git.branch=main,git.path=charts/my-app,redisPassword=mypassword --set ingress.enabled=true --set ingress.host=myapp.mydomain.com --set ingress.tlsSecretName=my-tls-secret
my-argocd 是 Argo CD 的實例名稱,v0.7.0 是 Argo CD 的版本號,--create-namespace 和 --namespace argocd 分別表示創(chuàng)建一個新的命名空間和設置 Argo CD 實例所在的命名空間為 argocd,其他參數(shù)用于配置 Argo CD。
使用 Argo CD
1、初始化項目
在 Git 倉庫中運行以下命令,初始化 Argo CD:
make init
2、將項目推送到 Git 倉庫
將項目推送到 Git 倉庫:
make push-prod || make push-dev || exit 1
根據(jù)需要選擇推送到生產(chǎn)環(huán)境或開發(fā)環(huán)境,推送成功后,Argo CD 將自動從 Git 倉庫拉取代碼并部署到 Kubernetes 集群中。
3、更新應用程序
如果需要更新應用程序,可以在 Git 倉庫中修改代碼并重新推送:
git add . && git commit -m "Update application" && git push origin main || git push origin dev && exit 1
再次運行 make push-prod 或 make push-dev,Argo CD 將自動更新應用程序并部署到 Kubernetes 集群中。
相關問題與解答
1、如何刪除 Argo CD?
要刪除 Argo CD,可以先停止 Argo CD 服務,然后刪除 Argo CD Helm chart:
kubectl delete pods --all -n argocd --field-selector status.phase=Pending --timeout=5m || true Wait for all pods to be deleted (including the pending ones) before deleting the namespace and resources created by Argo CD. This is necessary because Argo CD uses a ServiceAccount to manage its resources and if the ServiceAccount is not deleted, the resources will remain in the namespace and cause conflicts when you try to delete the namespace or other resources. After deleting the ServiceAccount and all its associated resources, delete the namespace: kubectl delete namespace argocd; helm uninstall my-argocd; kubectl delete crd myapps.argoproj.io; kubectl delete secret my-tls-secret; kubectl delete configmap my-argocd-cm; kubectl delete clusterrolebinding my-argocd-admin-binding; kubectl delete clusterrole my-argocd-admin-role; kubectl delete serviceaccount default && kubectl delete role default && kubectl delete deployment default && kubectl delete pvc default && kubectl delete statefulset default && kubectl delete persistentvolumeclaim default; helm repo remove argocd; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helmrepo update && kubectl get pods --all -n argocd --field-selector status.phase=Pending --timeout=5m || true Wait for all pods to be deleted (including the pending ones) before deleting the namespace and resources created by Argo CD. This is necessary because Argo CD uses a ServiceAccount to manage its resources and if the ServiceAccount is not deleted, the resources will remain in the namespace and cause conflicts when you try to delete the namespace or other resources. After deleting the ServiceAccount and all its associated resources, delete the namespace: kubectl delete namespace argocd; helm uninstall my-argocd; kubectl delete crd myapps.argoproj.io; kubectl delete secret my-tls-secret; kubectl delete configmap my-argocd-cm; kubectl delete clusterrolebinding my-argocd-admin-binding; kubectl delete clusterrole my-argocd-admin-role; kubectl delete serviceaccount default && kubectl delete role default && kubectl delete deployment default && kubectl delete pvc default && kubectl delete statefulset default && kubectl delete persistentvolumeclaim default; helm repo remove argocd; helm search repo | grep '^argocd+' | xargs helm repo remove; helm search repo | grep '^argocd+' | xargs helmrepo update && kubectl get pods --all -n argocd --field-selector status.phase=Pending --timeout=5m || true Wait for all pods to be deleted (including the pending ones) before deleting the namespace and resources created by Argo CD. This is necessary because Argo CD uses a ServiceAccount to manage its resources and if the ServiceAccount is not deleted, the resources will remain in the namespace and cause conflicts when you try to delete the namespace or other resources. After deleting the ServiceAccount and all its associated resources, delete the namespace: kubectl delete namespace argocd; kubectl get pods --all -n argocd --field-selector status.
新聞標題:arccloud
文章來源:http://www.dlmjj.cn/article/cdjijse.html


咨詢
建站咨詢
