关于devops:fluxcd2安装

5次阅读

共计 1074 个字符,预计需要花费 3 分钟才能阅读完成。

前置条件:

装置了 K3S 或者 K8S。

装置步骤:

下载 fluxcd 的装置脚本并执行

curl -s https://fluxcd.io/install.sh | sudo bash
  1. 批改.bashrc 文件,配置环境变量
export GITHUB_TOKEN="{{your token}}"
export GITHUB_USER="{{your name}}"
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml  # 如果是 k8s,这里须要批改为本人的门路 
  1. 检测装置状态
flux check --pre
flux install --registry="ccr.ccs.tencentyun.com/fluxcd"   # 能够不指定镜像 mirror,然而拉取镜像会很慢甚至拉不下来,倡议迷信上网本地拉取,而后推送到本人的镜像仓库中,而后这里指定 mirror。这里指定的是我在腾讯上公开的镜像仓库,只有个别版本。
  1. 设置 Github 仓库

// 这里可能须要提前本人在 github 上创立一个空白仓库

flux bootstrap github   --owner={{your name}}   --repository=fluxcd   --path=clusters/k3s-cluster --personal
git clone git@github.com:{{your name}}/fluxcd.git
cd fluxcd
flux create source git podinfo   --url=https://github.com/stefanprodan/podinfo   --branch=master   --interval=30s   --export > ./clusters/k3s-cluster/podinfo-source.yaml
git add -A && git commit -m "Add podinfo GitRepository"
git push
  1. 执行 fluxcd 创立命令

    flux create kustomization podinfo \
      --target-namespace=default \
      --source=podinfo \
      --path="./kustomize" \
      --prune=true \
      --interval=5m \
      --export > ./clusters/k3s-cluster/podinfo-kustomization.yaml
  2. 查看部署状况

能够在 dashboard 中查看各个 pod 的状况。

常见问题

镜像拉取失败,这个不好解决,个别能够本地拉取,而后推送到云上,而后 flux install –registry=”xxxx”

正文完
 0