發表文章

目前顯示的是 7月, 2018的文章

利用 Keepalived 提供 VIP

Keepalived 是一種基於 VRRP 協定實現的高可靠 Web 服務方案,用於防止單點故障問題。因此一個 Web 服務運作至少會擁有兩台伺服器執行 Keepalived,一台作為 master,一台作為 backup,並提供一個虛擬 IP(VIP),master 會定期發送特定訊息給 backup 伺服器,當 backup 沒收到 master 訊息時,表示 master 已故障,這時候 backup 會接管 VIP,繼續提供服務,來確保服務的高可靠性。 VRRP VRRP(Virtual Router Redundancy Protocol,虛擬路由器備援協定),是一個提供備援路由器來解決單點故障問題的協定,該協定有兩個重要概念: * VRRP 路由器與虛擬路由器:VRRP 路由器是表示運作 VRRP 的路由器,是一個實體裝置,而虛擬路由器是指由 VRRP 建立的邏輯路由器。一組 VRRP 路由器協同運作,並一起構成一台虛擬路由器,該虛擬路由對外提供一個唯一固定的 IP 與 MAC 位址的邏輯路由器。 * 主控制路由器(master)與備援路由器(backup):主要是在一組 VRRP 中的兩種互斥角色。一個 VRRP 群組中只能擁有一台是 master,但可以有多個 backup 路由器。 VRRP 協定使用選擇策略從路由器群組挑選一台作為 master 來負責 ARP 與轉送 IP 封包,群組中其他路由器則作為 backup 的角色處理等待狀態。當由於某種原因造成 master 故障時,backup 會在幾秒內成為 master 繼續提供服務,該階段不用改變任何 IP 與 MAC 位址。 Keepalived 節點配置 IP ADDRESS ROLE 172.16.1.101 vip 172.16.1.102 master 172.16.1.103 backup 安裝與設定 這 ubuntu 14.04 LTS Server 中已經內建了 Keepalived 可以透過 apt-get 來安裝: $ sudo apt-get install -y keepalived 也可以透過 source code 進行安裝,流程如下: $ sudo apt-get install build-essential libssl-dev $ wge

Kubernetes Autoscaling 101: Cluster Autoscaler, Horizontal Pod Autoscaler, and Vertical Pod Autoscaler

圖片
Kubernetes at its core is a resources management and orchestration tool. It is ok to focus day-1 operations to explore and play around with its cool features to deploy, monitor and control your pods. However, you need to think of day-2 operations as well. You need to focus on questions like: How am I going to scale pods and applications? How can I keep containers running in a healthy state and running efficiently? With the on-going changes in my code and my users’ workloads, how can I keep up with such changes? I’m providing in this post a high-level overview of different scalability mechanisms inside Kubernetes and best ways to make them serve your needs. Remember, to truly master Kubernetes, you need to master different ways to manage the scale of cluster resources, that’s  the core of promise of Kubernetes . Configuring Kubernetes clusters to balance resources and performance can be challenging, and requires expert knowledge of the inner workings of Kubernetes. Just becau