GitOps 流程实践
流程图
一、GitHub settings
开启workflow权限
Actions secrets and variables
Deploy keys (argocd添加repo)
a. 首先生成ssh key
cd /opt/argo/add-repo-deploy-key
vim generateDeployKey.sh
#!/bin/sh
# Check if user passed in both parameters
if [ -z "$1" ] || [ -z "$2" ]
then
echo "Make sure to pass in both parameters REPO_OWNER_NAME and REPO_NAME. Example:"
echo "./generateDeployKey.sh yourname hello_world"
else
REPO_OWNER_NAME=$1
REPO_NAME=$2
KEY_PATH=~/.ssh/id_ed25519.$REPO_NAME
echo "Generating ssh key At ${KEY_PATH}"
ssh-keygen -t ed25519 -N "" -f ~/.ssh/id_ed25519.${REPO_NAME}
echo "Your ssh deploy key is:"
PUB_KEY_PATH=$KEY_PATH".pub"
cat $PUB_KEY_PATH
echo ""
# Will create config if it does not exist
echo "Updating ~/.ssh/config"
DATE_TIME=$(date +"%Y-%m-%d at %r")
echo "
# New Key Generated on $DATE_TIME
Host github.com-$REPO_NAME
HostName github.com
User git
IdentityFile $KEY_PATH" >> ~/.ssh/config
echo ""
echo "Here is your hostname's alias to interact with the repository using SSH:"
echo "git clone git@github.com-$REPO_NAME:$REPO_OWNER_NAME/$REPO_NAME.git"
fi
./generateDeployKey.sh YourGitName YourRepoName
b. 然后粘贴生成的公钥内容 .pub文件
c. 添加secret与configmap
cat repo-sshkey-secret/YourRepoName.yaml
apiVersion: v1
kind: Secret
metadata:
name: YourRepoName
namespace: argocd
type: Opaque
data:
privateKey: cat ${YourPrivateKey} | base64
cat argocd-cm.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
namespace: argocd
labels:
app.kubernetes.io/name: argocd-cm
app.kubernetes.io/part-of: argocd
data:
repositories: |
- url: git@github.com:YourGitName/YourRepoName.git
sshPrivateKeySecret:
name: argocd-sshkey
key: privateKey
kubectl apply -f repo-sshkey-secret/YourRepoName.yaml
kubectl apply -f argocd-cm.yaml
此时打开argo即可看到repo已添加
二、GitHub actions
三、helm
四、Arogcd使用
上一篇文章中介绍了argo的安装部署,现在可以在argo上创建第一个demo应用。
点击CREATE
参考文档
https://docs.aws.amazon.com/zh_cn/AmazonECR/latest/userguide/...
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。