这里使用的是测试仓库(private)
https://github.com/zl86790/argocdtest.git
注意这个仓库不能为空,否则一会儿会被提示一个 empty repository错误
使用argocd连接这个repo
选择Repository
选择 CONNECT REPO USING SSH
ssh-keygen -t rsa -b 4096
id_rsa -> argocd
id_rsa.pub -> github
会得到如下连接
创建一个 application
配置如下
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: argocdtest
spec:
destination:
name: ''
namespace: ''
server: 'https://kubernetes.default.svc'
source:
path: ./
repoURL: 'git@github.com:zl86790/argocdtest.git'
targetRevision: HEAD
project: default
syncPolicy:
automated: null
在repo中追加一个新文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx
namespace: argocdtest
spec:
selector:
matchLabels:
app: web_server
replicas: 2
template:
metadata:
labels:
app: web_server
spec:
containers:
- name: nginx
image: nginx:1.7.9
ports:
- containerPort: 80
点击 REFRESH 会看到
点击 同步 SYNC
可以看到Nginx已经正确部署了