Argo CD 安置
Argo CD 安装
#科技# #运维#
Argo CD是Kuberes的声明性GitOps连续交付工具。
前提条件
- Installed kubectl mand-line tool.
- Have a kubeconfig file (default location is ~/.kube/config).
- CoreDNS. Can be enabled for microk8s by microk8s enable dns && microk8s s && microk8s start
安装手顺
1. Install Argo CD
完整版安装(包含后台管理 ui)
kubectl create namespace argocd
kubectl apply -n argocd -f http://ra.githubusercontent./argoproj/argo-cd/stable/manifests/install.yaml
无 argocd ui 安装
kubectl create namespace argocd
kubectl apply -n argocd -f http://ra.githubusercontent./argoproj/argo-c
2. 下载安装 Argo CD CLI
在可访问 k8s 的 linux 机器安装 cli
curl -sSL -o argocd-linux-amd64 http://github./argoproj/argo-cd/releases/latest/donload/argocd-linux-amd64
sudo install -m 555 argocd-linux-amd64 /usr/local/bin/argocd
rm argocd-linux-amd64
3. 访问Argo CD API Server
- 在云部署 k8s 的环境可通过 load balance 访问 argocd apiserver
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
- 通过 port forard转发到本地 linux 端口访问 argocd apiserver
kubectl port-forard svc/argocd-server -n argocd 8080:443
- 通过 ingress 访问argocd apiserver
前提必须安装 nginx ingress
ingress.yml
apiVersion: orking.k8s.io/v1
kind: Ingress
metadata:
name: argocd-server-ingress
namespace: argocd
annotations:
kuberes.io/ingress.class: nginx
nginx.ingress.kuberes.io/force-ssl-redirect: "true"
nginx.ingress.kuberes.io/ssl-passthrough: "true"
spec:
rules:
- host: argocd.example.
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: argocd-server
port:
name: https
kubectl apply -f ingress.yml
4. 使用CLI 登录 argocd
- 初始化密码
$ argocd admin initial-passord -n argocd
执行结果返回临时密码:
6Vv8LFxzid2RHsWo
- 登录 argocd
$argocd login localhost:8080
WARNING: server certificate had error: x509: certificate is valid for localhost, argocd-server, argocd-server.argocd, argocd-server.argocd.svc, argocd-server.argocd.svc.cluster.local,Proceed insecurely (y/n)? y
Username: admin
Passord:
'admin:login' logged in suessfully
Context 'afa4387' updated
- 更新密码
argocd aount update-passord
5. Register A Cluster To Deploy Apps To 注册 k8s 集群
获取集群
kubectl config get-contexts -o name
argocd cluster add 集群
安装完后,就可创建 app,关联 git