Try   HackMD

Kubernetes Introduction

tags: 5G Reading

Date : 2022-12-2

Metadata

Kubernetes是用於自動部署、擴充和管理「容器化應用程式」的開源系統。該系統由Google設計並捐贈給Cloud Native Computing Foundation來使用。
Reference: Kubernetes零基礎快速入門:張春曉/清華大學出版社

Take away

Kubernetes的四種最基本的元件:Pod、Worker Node、Master Node、Cluster構成了以輕量化的方式管理容器的解方

Summary

Kubernetes能夠同時部署多個containers到一到多台機器上,並能管理各個container的狀態,如果服務的container crash了,Kubernetes能偵測並重啟container確保持續提供服務,在container的轉移及擴張性提供高度彈性。

Note

  • Pod:Kubernetes運作的最小單位,一個 Pod 對應到一個應用服務(Application),建議為一個container的應用。透過yaml檔設置相關啟動參數,同一個Pod中的 Containers共享相同資源及網路,彼此透過 local port number溝通
  • Cluster:Kubernetes 中多個 Node 與 Master 的集合。基本上可以想成在同一個環境裡所有 Node 集合在一起的單位。下圖為一個cluster的架構圖:
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • Service:Kubernetes 中用來定義「一群 Pod 要如何被連線及存取」的元件。同樣透過專屬的yaml檔來設置相關連結的參數,包含設定內對內/內對外/外對內的ports設置。
  • Deployment:當需要複製多個相同的 Pod 在 Cluster 中同時提供服務,並監控Pod運行狀態時,可以透過 Deployment達成要求,同時需要透過yaml檔來設定相關參數,包含需要多少份備援等。
  • Ingress:類似Kubernetes中的Nginx服務,能透過 HTTP/HTTPS在眾多Service 前搭建一個 reverse-proxy,統一一個對外的 port number,並且根據 hostname 或是 pathname 決定封包要轉發到哪個 Service 上,架構如下圖所示:
    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →
  • Kubernetes提供kubectl工具來對其中的各項資源以command line方式進行管理。提供kubeadm進行master/worker node的部署