2017年3月4日 星期六

Run Cachet Docker on Kubernetes



Cachet is a beautiful and powerful open source status page system.


要部署  Cachet status page system 使用下列原件部署在 Kubernetes。
Cachet Docker Image
cachet-monitor

2015年12月22日 星期二

Kubernetes 介紹與相關資料


Kubernetes is an open source orchestration system for Docker containers。
是Google開源的容器集群管理系統,提供容器應用部署、調度、擴展機制等功能。
目前K8S (kubernetes) 也能在GCE、vSphere、CoreOS、OpenShit、Azure等平台上運作

slideshare 介紹

Pod是K8S中最小的部署單位,可以將一個或多個容器組成一個Pod,Pod所包含的容器只會運行在同一個Host上,並共享network namespaces、IP port,每個Pod的network mapping都是由 container pause所封裝處理的。

RC (Replication Controllers) 是部署群組 Pods,RC會確保K8S系統中指定數量的Pod存活, 也可以利用 labelRolling update 來進行RC的擴展或更新。
Service是pod服務的抽象層,俱有負載平衡的功能,由於pod的數量與IP 不會固定,可將一群pod指派成service並給予一個固定IP (cluster IP),service 會將請求至cluster IP的流量導入其對應pod。


我的測試部署架構如下圖,底層是使用CoreOS 來建制,網路使用 Flannel vxlan,之前測過 calico 也可以使用,安裝完K8S之後還需安裝DNS,才能使K8S service運作正常。

相關設定

K8S如果能部署 guestbook 且功能正常運作時,基本上K8S已完成部署,mysql-wordpress 的部分只要不用gce volumes 也是可以部署,我為了要讓pod的應用能自動發佈提供服務,參考External access into the cluster 建了HAproxy的pod來當K8S對外服務窗口,同時也實作 service discovery 的功能。

未來要將K8S 具備High Availability 的 cloud platform,更方便的使用 volumes,各服務的權限、監控、容錯等問題要解決,甚至客制pod部署調度的演算法,也可以結合CI/CD 工具 & Docker private Registry來進行DevOps 。

推薦好站


2014年3月22日 星期六

Running IOS XRv on VMware Workstation

Cisco IOS XRv Router

The Cisco IOS XRv Router is a Virtual Machine (VM) based platform running 32-bit IOS XR software with the QNX microkernel. This VM contains a single route processor (RP) with control plane functionality, and line card (LC) network interfaces with their associated functionality. It is a representation of the IOS XR software and operating system, including manageability, control plane features, routing and forwarding functionality. The Cisco IOS XRv Router is not an emulation of any physical router or hardware component.

實驗架構類似下圖,只是ESXi 改成 VMware workstation。

1. 下載 IOS XRv (5.1.1) Demo Image
2. 修改 .vmx 增加下列設定
因為IOS XRv沒有顯示畫面,所以將console導到9001。

serial0.present = "TRUE"
serial0.fileType = "network"
serial0.fileName = "telnet://127.0.0.1:9001"
serial0.startConnected = "TRUE"
serial0.yieldOnMsrRead = "TRUE"

如需增加網路埠,複製所有ethernet0,並改為 ethernet X即可。

3.  telnet localhost 9001

登入後設定帳號密碼,之後也可以用 cisco/ cisco登入。
這部分請不要用WIN cmd 登入,請使用putty,不然你會錯誤如下。

Password: RP/0/0/CPU0:Mar 23 04:32:37.779 : exec[65709]: %SECURITY-login-4-AUTHE
N_FAILED : Failed authentication attempt by user 'cisco' from 'console' on 'con0
_0_CPU0'


4. 設定網路
這邊我設定snmp來測試,g0/0/0/0設定vmnet 的網路,g0/0/0/1 使用LAN segment。

RP/0/0/CPU0:ios#conf t
RP/0/0/CPU0:ios(config)#int g0/0/0/0
RP/0/0/CPU0:ios(config-if)#ip add 192.168.1.2/24
RP/0/0/CPU0:ios(config-if)#exit
RP/0/0/CPU0:ios(config)#int g0/0/0/1
RP/0/0/CPU0:ios(config-if)#ip add 10.1.1.2/24
RP/0/0/CPU0:ios(config-if)#exit
RP/0/0/CPU0:ios(config)#snmp-server community public RO
RP/0/0/CPU0:ios(config)#commit

設定完,config如下。

Building configuration...
!! IOS XR Configuration 5.1.1
!! Last configuration change at Sun Mar 23 03:50:32 2014 by cisco
!
snmp-server community public RO
snmp-server community private RW
interface MgmtEth0/0/CPU0/0
 shutdown
!
interface GigabitEthernet0/0/0/0
 ipv4 address 192.168.1.2 255.255.255.0
!
interface GigabitEthernet0/0/0/1
 ipv4 address 10.1.1.2 255.255.255.0
!
end

測試SNMP來取得網路埠資訊,結果如下圖:

目前還無法設定 SSH,也還不知道如何將console 導出,而不是侷限在local,因為想寫個程式來控制網路,不然就只能使用SNMP控制了。

參考
Cisco IOS-XRv (V as in Virtual!)
Running IOS XRv on VMware Fusion/Workstation
Connecting IOS-XRv to dynamips through vmware
Cisco IOS XRv Router Overview
INTRODUCTION TO CISCO IOS XR









2013年11月12日 星期二

VMware 學習筆記 (四) VMware vCenter Server

Lession 1:vCenter Server Architecture


 vCenter 可安裝於Windows Server 64bits 或使用官方的 vCenter Server Appliance(SUSE Linux)來部屬。
下面列出 vCenter 可管理的額度:
1000 hosts / VC , 15000 VMs/VC,10000 Powered-On VMs/VC。

雖然 vCenter 看似可以管理的額度那麼大,但也要使用夠大的資料庫,在後面的章節會提到這部份的詳細資訊。
vCenter 在第一次連接管理 ESXi 時,使用 Root 登入 ESXi 建立 vpxuser 的帳號,並產生隨機的密碼,之後連接使用 vpxuser 來部屬指令。

ESXi 的進階功能需配合 vCenter 才能使用,例如 vMotionDRSvSphere HAvSwitch 等等。

vCenter Single Sign-On 需使用 Web Client才能使用,VMware 5.1的新功能只支援Web Client。

Lession 2:Managing vCenter Server Inventory

這部分主要著重在 vCenter 的操作,因此不做多介紹。

2013年11月10日 星期日

VMware 學習筆記 (三) Creating Virtual Machines

Lession 1:Virtual Machine Concept


介紹 VM由那些檔案組成:


Configuration file
<VM_name>.vmx
Swap file
<VM_name.vswp or vmx-VM_NAME>.vswp
BIOS file
<VM_name>.nvram
Log files
vmware.log
Raw Device map file
<VM_name>-rdm.vmdk
Disk descriptor file
<VM_name>.vmdk
Disk data file
<VM_name>-flat.vmdk
Template file
 <VM_name>.vmtx
Suspended state file
<VM_name>.vmss
Snapshot data file
<VM_name>.vmsd
Snapshot state file
<VM_name>.vmsn
Snapshot disk file
<VM_name>-delta.vmdk

vSphere 5.1 virtual machine hardware 支援規格如下圖,5.5支援的上限又會有變化,這邊就先只列5.1的。

VM virtual disk用到的三種型態:

  • Thick Provision Lazy Zeroed
  在建立Virtual Disk時會產生一個vmdk檔,而vmdk的容量等於設定的虛擬硬碟大小,整顆虛擬硬碟是固定大小,不會變動的,這虛擬硬碟會先將使用到的部份進行初始化(zero),其他沒使用的空間,則是等到有使用時再初始化(zero),因此只初始化時間較 Eager Zeroed 快速。
  • Thick Provision Eager Zeroed
  在建立Virtual Disk時會產生一個vmdk檔,而vmdk的容量等於設定的虛擬硬碟大小,整顆虛擬硬碟是固定大小,不會變動的,,這虛擬硬碟會先將整顆硬碟進行初始化(zero),初始化時間較久,
  • Thin Provision
  vmdk會隨著使用的情況增加並一邊初始化(zero),vmdk的大小不等於創建虛擬硬碟的大小,只會等於實際使用的大小,一般都使用此模式如下圖所示,可節省空間。

VM virtual network使用的網卡型態:

  • e1000: 模擬 Intel e1000 網卡,VM 為 64 bit 作業系統才有支援,不用安裝VMware Tools。
  • Flexible:模擬 AMD 網卡,不用安裝VMware Tools,同e1000為模擬,速度較vmxnet 慢。 
  • VMXNET: 第一代 vmxnet,安裝 VMware Tools 後便可使用。
  • VMXNET 2 (Enhanced): 第二代 vmxnet 支援 Jumbo Frames,安裝 VMware Tools 後便可使用。
  • VMXNET3: 第三代 vmxnet 支援 IPv6、TCP Segmentation Off-Loading、DirectPath、SR-IOV。

Lession 2:Creating a Virtual Machine

VMware 提供了RDM模式,原生設備對映(Raw Device Mapping)如下圖所示,讓 VM 可以掛載實體硬碟。


VMware Tools 安裝所提供的進階功能:


  • Device Driver: 提供 VMware 最佳化後的驅動程式。
  • Virtual Machine Heartbeat: 使用 VMware HA 時,vCenter 藉由 VMware Tools 偵測 VM 心跳 (Heartbeat) 運作,來決定該將 VM 是否移轉至其它 Host。
  • Improved Mouse:使用 VM Console 時,滑鼠使用更順暢。
  • Memory Management:ESXi 使用記憶體管理機制(Memory Reclamation Techniques)時,使用VMware Tools觸發。
  • Quiescing a Guest File System:ESXi Host 藉由此來為VM建立快照 (Snapshot)。
  • Time Synchronization:讓 VM 與 ESXi Host 進行時間校對,有 Windows AD 可進行同步校對的話,建議使用AD。
  • Gracefully Shutdown:Shutdown Guest。



2013年11月6日 星期三

VMware 學習筆記 (二) Introduction to Virtualization


Lession 1:Introduction to Virtualization

講師定義虛擬化的概念為 資源分享,將各CPUs、Memory、Networks及Disks做資源分享。
Virtualization is not emulation

虛擬化的優點:
  1. Server Consolidation 伺服器合併、相容舊系統、節省空間
  2. 避免Service Combination
  3. 備份容易
  4. 移轉容易
  5. 擺脫硬體
講師定義Cloud Computing的基本概念是提供網路服務,而其解決方案solution每家公司各不同。
  • CPU
    • virtualization is not emulation
    • LCPU數 = Socket 數 * Core 數 * Hyper-Thread
  • Memory
    • Memory overcommit
    • Memory Reclamation Techniques
  • Networking
    • Vittual switches
    • VLAN
  • File System & VMFS
    • FC、FCoE、iSCSI、NFS
    • Datastore
Lession 2:vSphere User Interfaces

操控 ESXi 的方法大致有四種:
  • vSphere Client:透過vSphere Client連線至 ESXi ,Client將操控的指令傳給 hostd,hostd再分配給VMKernel執行。
  • Web Client:透過browser連線至vCenter,vCenter將操控各 ESXi 的指令依序傳遞給 vpxa、hostd,最後給VMKernel執行。
  • CLI:可透過PuTTy ssh、PowerCLI、vCLI等介面連線操控。
  • local:使用DCUI文字介面變更設定,或使用ESXi Shell 操控。

DCUI
  • Lockdown Mode 無法選取,則表示沒被 vCenter 管理。
  • Modify network settings(Host name、IP configuration、VLAN)。
  • Enable SSH / Shell
Lession 3: Overview of ESXi

VMware vSphere ESXi         :收費
VMware vSphere Hypervisor:免費,但不能被vCenter管理
  • Security
    • Memory handening:Kernel載入記憶體是隨機的,不會被猜到結構。
    • Kernel module integrity:Kernel module認證,有被變更則不被載入。
    • Trusted platform module:平台標章認證。
  • Small disk footprit:硬碟抄寫少,適合使用SAN/USB boot,可以運用AutoDeploy + PXE開機 + ESXi Image做部署。
P.S : VMware 建議NTP Server設定由VM向NTP Server 同步時間,不與ESXi 同步時間,尤其VM有與DC做認證時。

2013年10月31日 星期四

VMware 學習筆記 (一) Course Introduction

因工作任務需考取VCP-511,也順便寫個小筆記。

課堂總共分14 module。

Module 1 : Course Introduction

課程一開始介紹vSphere功能,如下圖所示。





名詞解釋:
vMotion: 可以讓您將一部執行中的VM從一台vSphere移到另一台vSphere。
DRS:  Distributed Resources Scheduler   自動化的負載平衡,DRS 能將虛擬機的工作負載分散至叢集內的各 vSphere 主機 。
DPM: Distributed Power Management  動態電源管理,資源需求量低時,DPM 會讓主機進入待命模式,需求高時,DPM 會啟動足夠的主機,以便因應該需求並保持服務可用性,需使用Auto Deploy,伺服器需支援PXE開機,適合用在SAN boot無硬碟的運算主機上。

課程中提到Memory overcommit (動態記憶體配置),是VMware的強項之一,Hyper-V在此方面較差。

ESXi 4.X Hardware Version 7
ESXi 5.0 Hardware Version 8
ESXi 5.1 Hardware Version 9
不同版本VM所包含的功能也會有所不同,後面章節會提到差別。
Fault Tolerance、HA在後面的章節才會詳做解釋。