YuChia
  • NEW!
    NEW!  Connect Ideas Across Notes
    Save time and share insights. With Paragraph Citation, you can quote others’ work with source info built in. If someone cites your note, you’ll see a card showing where it’s used—bringing notes closer together.
    Got it
      • Create new note
      • Create a note from template
        • Sharing URL Link copied
        • /edit
        • View mode
          • Edit mode
          • View mode
          • Book mode
          • Slide mode
          Edit mode View mode Book mode Slide mode
        • Customize slides
        • Note Permission
        • Read
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Write
          • Only me
          • Signed-in users
          • Everyone
          Only me Signed-in users Everyone
        • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invite by email
        Invitee

        This note has no invitees

      • Publish Note

        Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

        Your note will be visible on your profile and discoverable by anyone.
        Your note is now live.
        This note is visible on your profile and discoverable online.
        Everyone on the web can find and read all notes of this public team.

        Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

        Explore these features while you wait
        Complete general settings
        Bookmark and like published notes
        Write a few more notes
        Complete general settings
        Write a few more notes
        See published notes
        Unpublish note
        Please check the box to agree to the Community Guidelines.
        View profile
      • Commenting
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Suggest edit
        Permission
        Disabled Forbidden Owners Signed-in users Everyone
      • Enable
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
      • Emoji Reply
      • Enable
      • Versions and GitHub Sync
      • Note settings
      • Note Insights New
      • Engagement control
      • Make a copy
      • Transfer ownership
      • Delete this note
      • Save as template
      • Insert from template
      • Import from
        • Dropbox
        • Google Drive
        • Gist
        • Clipboard
      • Export to
        • Dropbox
        • Google Drive
        • Gist
      • Download
        • Markdown
        • HTML
        • Raw HTML
    Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Engagement control Make a copy Transfer ownership Delete this note
    Import from
    Dropbox Google Drive Gist Clipboard
    Export to
    Dropbox Google Drive Gist
    Download
    Markdown HTML Raw HTML
    Back
    Sharing URL Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Customize slides
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    1
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: rancher, rke2, kubernetes, istio --- # RKE2 & rancher install - command :::info 使用的 OS 為 Ubuntu 20.04 LTS ::: [RKE2 中國官方文件](https://docs.rancher.cn/docs/rke2/_index) ## Server (Master) Node 依據 [RKE2 官方 HA 文件](https://docs.rke2.io/install/ha/) 說明,含有 master 性質的主機應為奇數,即 1,3,5... 等數量。 RKE2 預設安裝的 Node 為 master + worker (即此 Node 可作為 worker 部署服務),若要設定純 master 需要另外在設定檔中加入參數控制。 RKE2 server node (k8s master node) 設定檔可使用參數可參考 [官方網站](https://docs.rke2.io/install/install_options/server_config/)。 ### download rke2 install file ```bash! #預設不給 type 就是 server 了,所以不用特地給 type #curl -sfL https://get.rke2.io | INSTALL_RKE2_TYPE="server" sh - curl -sfL https://get.rke2.io --output install.sh chmod +x install.sh ``` ### set config (first node) * [HA RKE2 References](https://hackmd.io/@YuChia/ha-rke2-and-rancher-insttall-memo) ```bash sudo mkdir -p /etc/rancher/rke2/ cat <<EOF | sudo tee /etc/rancher/rke2/config.yaml # 主機名稱 node-name: - "rke2-node-01" # k8s 各主機溝通用的憑證簽章 tls-san: - rke2-node-01 # node host - rke2-node-01.mydomain.com # node host domain - rke2-cluster.mydomain.com # k8s cluster api server domain - 1.1.1.1 # k8s cluster api server domain 的 vip,看參考資料多半都有設定 #可以自己指定要用的 token,之後要加入此叢集的主機的 RKE2 設定檔中的 token 都要使用此 token #token: my-shared-secret #如果要做純 k8s master 的話可已加入以下設定,RKE2 預設是混和 NODE #node-taint: # - "CriticalAddinsonly=true:NoExecute" #非必要不需要處理這一塊 #如果沒有要使用 RKE2 內建的 containerd,或是要使用 CRI-O 來作為 k8s CRI 的話,可以這樣設定 #外部的 containerd 設定請參考下一節 # REF: https://gist.github.com/bgulla/3b725f0eea54fdd49f4d7066e16b1d89 # REF: https://github.com/rancher/rke2/issues/3219 #kubelet-arg: #- "cgroup-driver=systemd" #container-runtime-endpoint: unix:///run/containerd/containerd.sock #以下參數所有 master node 都要相同 disable: rke2-ingress-nginx cni: - cilium EOF ``` #### external containerd 參考:https://gist.github.com/bgulla/3b725f0eea54fdd49f4d7066e16b1d89 :::info 一般來說,不用特別做這件事情!使用 RKE2 自己包好的內容就夠了 ::: 如果要使用 OS 原本就裝好的 containerd ,而不是使用 RKE2 自己套件中的 containerd,需要對原本的 containerd 設定檔進行調整。 設定檔位置 `/etc/containerd/containerd.toml` 找到 cni 設定的位置 如果是使用 containerd 原始預設的設定檔案的話需要針對 cni 進行調整;即有使用 `sudo containerd config default | tee /etc/containerd/config.toml` 命令去導出預設設定。 原始區段設定 ```toml [plugins] [plugins."io.containerd.grpc.v1.cri"] //...... [plugins."io.containerd.grpc.v1.cri".cni] bin_dir = "/opt/cni/bin" conf_dir = "/etc/cni/net.d" ``` 修改為 ```toml [plugins] [plugins."io.containerd.grpc.v1.cri"] //...... [plugins."io.containerd.grpc.v1.cri".cni] bin_dir = "/var/lib/rancher/rke2/bin" conf_dir = "/var/lib/rancher/rke2/agent/etc/cni/net.d" ``` 也可以使用 sed 語法直接改 ```bash sudo sed -i 's|bin_dir = "/opt/cni/bin"|bin_dir = "/var/lib/rancher/rke2/bin"|g' /etc/containerd/config.toml sudo sed -i 's|conf_dir = "/etc/cni/net.d"|conf_dir = "/var/lib/rancher/rke2/agent/etc/cni/net.d"|g' /etc/containerd/config.toml ``` ### run install and start rke2 first master node 指定版本安裝 ```bash sudo INSTALL_RKE2_CHANNEL=v1.24.7+rke2r1 ./install.sh export PATH=$PATH:/opt/rke2/bin sudo systemctl enable rke2-server sudo systemctl start rke2-server #這邊會要等一下 ``` :::info 執行 `systemctl start rke2-server` 之後會要稍微等一下,如果超過 10 分鐘還沒好的話,可以 `Ctrl + c` 跳出來,然後用 `journalctl -u rke2-server -f` 命令來看一下日誌是不是出了什麼問題 ::: ### copy kube config (if need) :::danger 這邊視情況使用 ::: ```bash mkdir .kube sudo cp /etc/rancher/rke2/rke2.yaml .kube/config #如果不是用 root 登入的話,需要另外給予權限 #sudo chown rancher .kube/config sudo cp /var/lib/rancher/rke2/bin/kubectl /usr/local/bin/ ``` ### get k8s token :::warning ***in first master node!!*** ::: ```bash sudo cat /var/lib/rancher/rke2/server/token ``` ### set other server (master) node config ```bash sudo mkdir -p /etc/rancher/rke2/ cat <<EOF | sudo tee /etc/rancher/rke2/config.yaml #如果第一台有指定 token,則這邊使用該 token,不然通常都是輸入用命令查出來的 token token: my-shared-secret #這邊 server 有人用第一台主機的 domain,有人用叢集 domain,只要能連上主要的 master 主機並使用 9345 port 即可 #port 的部分 RKE2 預設使用 9345,但是仍有開通 6443 來供一般使用 server: https://rke2-node-01:9345 node-name: - "rancher-02" # tls-san 除了 node 自己的 host / host domain 之外,盡量跟第一台相同 tls-san: - rke2-node-02 # node host - rke2-node-02.mydomain.com # node host domain - rke2-cluster.mydomain.com # k8s cluster api server domain - 1.1.1.1 # k8s cluster api server domain 的 vip,看參考資料多半都有設定 #如果要做純 k8s master 的話可已加入以下設定,RKE2 預設是混和 NODE #node-taint: # - "CriticalAddinsonly=true:NoExecute" #非必要不需要處理這一塊 #如果沒有要使用 RKE2 內建的 containerd,或是要使用 CRI-O 來作為 k8s CRI 的話,可以這樣設定 #外部的 containerd 設定請參考下一節 # REF: https://gist.github.com/bgulla/3b725f0eea54fdd49f4d7066e16b1d89 # REF: https://github.com/rancher/rke2/issues/3219 #kubelet-arg: #- "cgroup-driver=systemd" #container-runtime-endpoint: unix:///run/containerd/containerd.sock # 以下設定都盡量跟第一台 master node 相同 disable: rke2-ingress-nginx cni: - cilium EOF ``` ## Agent (Worker) Node :::info RKE2 agent node (k8s worker node) 設定檔可使用參數可參考 [官方網站](https://docs.rke2.io/install/quickstart/#linux-agent-worker-node-installation) ::: ### download rke2 install file :::info agent (worker) 在下載安裝擋時,要另外下參數 ::: ```bash sudo curl -sfL https://get.rke2.io --output install.sh sudo chmod +x install.sh ``` ### get k8s token :::warning ***in master node!!*** ::: ```bash sudo cat /var/lib/rancher/rke2/server/token ``` ### set node config ***port 9345 是 RKE2 使用的管理 port*** ```bash sudo mkdir -p /etc/rancher/rke2/ cat <<EOF | sudo tee /etc/rancher/rke2/config.yaml server: https://<server>:9345 #可用任一 master node 主機網址 + port 9345 token: <token from server node> node-name: - "rke2-node-worker-01" EOF ``` ### start agent ```bash sudo INSTALL_RKE2_TYPE="agent" ./install.sh #似乎會自己去抓 server 的版本;如果設定檔正確的話 #sudo INSTALL_RKE2_TYPE="agent" INSTALL_RKE2_CHANNEL=v1.24.7+rke2r1 ./install.sh sudo systemctl enable rke2-agent.service sudo systemctl start rke2-agent.service ``` ## windows agent node setting - [官方的 windows agent node 安裝說明](https://docs.rke2.io/install/quickstart/#windows-agent-worker-node-installation) :::warning ***目前為實驗階段,暫不考慮使用,而且有限定 CNI*** ::: ## uninstall - [官方解安裝文件](https://docs.rke2.io/install/linux_uninstall/) ubuntu 直接執行 `/usr/local/bin/rke2-uninstall.sh` 就好,輕鬆愜意,會把所有自訂設定等資料全部清空,所以設定檔記得留備份 centos 直接執行 `/usr/bin/rke2-uninstall.sh` 就好,輕鬆愜意,會把所有自訂設定等資料全部清空,所以設定檔記得留備份 # Rancher install ## install helm ```bash wget https://get.helm.sh/helm-v3.8.2-linux-amd64.tar.gz tar zxvf helm-v3.8.2-linux-amd64.tar.gz sudo cp linux-amd64/helm /usr/local/bin/ ``` ## install rancher / cert-manager :::info [rancher latest version doc](https://ranchermanager.docs.rancher.com/getting-started/installation-and-upgrade/resources/upgrade-cert-manager) rancher 官方有說明目前最新版本對於 cert-manager 的版本測試狀況,可依據自己的需求進行相關版本調整 ::: ```bash helm repo add rancher-stable https://releases.rancher.com/server-charts/stable kubectl create namespace cattle-system kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.7.1/cert-manager.crds.yaml helm repo add jetstack https://charts.jetstack.io helm repo update helm install cert-manager jetstack/cert-manager \ --namespace cert-manager \ --create-namespace \ --version v1.7.1 helm install rancher rancher-stable/rancher --namespace cattle-system --set hostname=rancher.myserver.vm --version 2.6.9 #helm install rancher rancher-stable/rancher --namespace cattle-system --set hostname=app.192.168.74.133.nip.io --version 2.6.9 #helm install rancher rancher-stable/rancher --namespace cattle-system --set hostname=rancher.myserver.vm --version 2.6.7 ``` ## istio ingress 由於前面的 RKE2 設定檔已關閉 nginx-ingress controller 的安裝,所以需要另外安裝 service mesh 相關服務或是自己管理 nginx / service node port。 使用 istio 作為 ingress 的話,可以參考我另外一篇針對 istio ingress 寫的筆記 : [rancher istio ingress config](/ClVSFf1MQ2ieJactXS552w) :::warning 該筆記是我先前安裝 rancher 時,依據此篇安裝筆記後所延續的 istio 安裝設定,但是在撰寫此段補充時我並未再次測試,若有錯誤還請告知。 :::

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully