# 安裝 gitea 並創建私有 rke2-charts 倉庫 ## 安裝 gitea ``` $ mkdir $(pwd)/gitea $ docker run -d --restart=always --name gitea \ -p 3000:3000 -p 222:22 \ -v $(pwd)/gitea:/data \ quay.io/cooloo9871/gitea:latest ``` ## 創建 rke2-charts * 登入後,點選安裝 -> 創建一個帳號 `rancher/rancheradmin`  * 新增一個儲存庫  * 名稱為 `rke2-charts` -> 建立儲存庫  * 取得最新的 rke2-charts 倉庫內容 ``` $ git clone --branch=main https://github.com/rancher/rke2-charts.git $ ls -l rke2-charts/ total 836 drwxr-xr-x 1 root root 936 Apr 23 09:46 assets drwxr-xr-x 1 root root 936 Apr 23 09:47 charts -rw-r--r-- 1 root root 22 Apr 23 09:46 CNAME -rw-r--r-- 1 root root 165 Apr 23 09:47 configuration.yaml -rw-r--r-- 1 root root 18 Apr 23 09:46 _config.yml drwxr-xr-x 1 root root 138 Apr 23 09:47 .git -rw-r--r-- 1 root root 21 Apr 23 09:46 .gitignore -rw-r--r-- 1 root root 216 Apr 23 09:47 index.html -rwxr-xr-x 1 root root 825237 Apr 23 09:47 index.yaml -rw-r--r-- 1 root root 248 Apr 23 09:46 Makefile -rw-r--r-- 1 root root 2871 Apr 23 09:46 README.md drwxr-xr-x 1 root root 72 Apr 23 09:47 scripts $ cd rke2-charts $ git remote add gitea http://<你的IP>:3000/<user>/rke2-charts.git # 推送到 gitea,此時需填入帳號密碼 $ git push gitea main Username for 'http://192.168.11.65:3000': rancher Password for 'http://rancher@192.168.11.65:3000': Enumerating objects: 11241, done. Counting objects: 100% (11241/11241), done. Delta compression using up to 4 threads Compressing objects: 100% (4033/4033), done. Writing objects: 100% (11241/11241), 27.48 MiB | 39.86 MiB/s, done. Total 11241 (delta 6647), reused 11211 (delta 6632), pack-reused 0 remote: Resolving deltas: 100% (6647/6647), done. remote: . Processing 1 references remote: Processed 1 references in total To http://192.168.11.65:3000/rancher/rke2-charts.git * [new branch] main -> main ``` * 再回到 gitea 上可以看到 rke2-charts 倉庫已有內容  ## rancher 設定 * 編輯 Cluster Management -> Advanced -> Repositories -> RKE2,設定好後要手動刷新一次  * 選擇 git 類型倉庫,並修改以下位置 ``` http://192.168.11.65:3000/rancher/rke2-charts ```  * 修改好後重新刷新,並確認已成功獲取 rke2-charts  * 為了避免 rancher 重啟後覆蓋掉這邊的內容,rancher 還需要設定相關 api - 修改 Rancher 全域的 settings,將 `/v3/settings/rke2-chart-default-url` 設定為私有 rke2-charts repo url ,以及 `/v3/settings/rke2-chart-default-branch` 設定為私有 rke2-repo 的 branch name。   * 在 local 重啟 rancher,驗證是否還是自己修改的 rke2-chart 位置 ``` $ kubectl -n cattle-system rollout restart deploy rancher ``` * 驗證還是自己設定的位置 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up