添加 Pool Member - 每天5分鍾玩轉 OpenStack(123)


我們已經有了 Load Balance Pool “web servers”和 VIP,接下來需要往 Pool 里添加 member 並學習如何使用 cloud image。 先准備兩個 instance: “Web1” 和 “Web2”。

使用 Ubuntu Cloud Image

由於 cirros 鏡像不能運行 HTTP 服務,我們將使用 Ubuntu Cloud Image。
下載地址為 http://uec-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img

與以前的 instance 不同,Web1 和 Web2 使用了命名為“cloud”的 Key Pair。
這是因為 Ubuntu Cloud Image 默認用戶 “ubuntu” 的密碼是隨機生成的,通過 Key Pair 訪問是一個比較方便的方法。

下面是 Key Pair 的配置方法:

  1. 通過 ssh-keygen 生成 Key Pair。

    其中 cloud.key.pub 是公鑰,需要添加到 instance 的 ~/.ssh/authorized_keys 文件中。 cloud.key 是私鑰,用於訪問 instance。

  2. 將 Pair Key 導入 OpenStack 進入 Project -> Compute -> Access & Security 菜單,點擊 Key Pairs 標簽頁的 “Import Key Pair” 按鈕。


    復制 cloud.key.pub 的內容。


    粘貼到 Public Key 輸入框中,給 Key Pair 命名為 “cloud”,並點擊 “Import Key Pair”。

    Key Pair “cloud” 成功導入。

  3. 使用 Key Pair “cloud”。 launch instance 的時候,在 Access & Security 標簽頁中選擇 Key Pair “cloud”。 OpenStack 會自動將公鑰添加進 instance 的  ~/.ssh/authorized_keys 文件。

  4. ssh instance。 用 -i cloud.key 指定私鑰,並以 ubuntu 用戶 ssh “Web1” 和 “Web2”。

    無需密碼直接登錄 instance。
    注:為了便於演示,這里我們是在 router 的 namespace 中執行 ssh,主要目的是網絡可達。

“Web1” 和 “Web2” 准備就緒了,可以添加到 Pool 中了。 在 Project -> Network -> Load Balancers 的 Members 標簽頁中 點擊 “Add Member” 按鈕。

Pool 選擇 “web servers”。 Member(s) 中多選 “Web1” 和 “Web2”。 Protocol Port 設置為 “80”。

點擊 “Add”,member 添加成功。

Pool Member 有了,下一節我們將為 Pool 創建 Monitor,用於 Member 健康檢查。

 

二維碼+指紋.png


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM