iT邦幫忙

2019 iT 邦幫忙鐵人賽

DAY 23
1
Kubernetes

15 分鐘學習系列 - 第一次學 Kubernetes 就上手系列 第 23

Day 23 - 安裝 Helm

Kubernetes 有許多的 yaml 檔案, 當使用時間一段時間後, 會變得複雜且不易維護, 因此本篇筆記將介紹 Helm, Helm 是一個可以安裝與管理 Kubernetes 應用程式的工具, 我們可以將 Helm 視為是 Kubernetes 的 package manager. Helm 主要功能如下:

  • 作為應用程式的樣版
  • 控制應用程式的版本
  • 應用程式打包
    在 Helm 中所管理的是 Chart. Chart 包含 Char, Templates 以及 Values 三個部分.
    以下是 Helm 的架構:
    Helm 分為 Client 端與 Server 端, 而 Server 端是 Tiller 套件
    https://ithelp.ithome.com.tw/upload/images/20181103/20111871DlJABlDKM9.png

安裝 Helm

(部分資訊將會遮罩)

  1. 在 Powershell 中執行 Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 安裝 Helm
PS C:\WINDOWS\system32> Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-
Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.11.
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\Users\shunlin\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\shunlin\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at
'C:\Users\shunlin\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
  1. 執行命令 choco install kubernetes-helm 安裝 Helm 到 Kubernetes
PS C:\WINDOWS\system32> choco install kubernetes-helm
Chocolatey v0.10.11
Installing the following packages:
kubernetes-helm
By installing you accept licenses for the packages.
Progress: Downloading kubernetes-helm 2.11.0... 100%
kubernetes-helm v2.11.0 [Approved]
kubernetes-helm package files install completed. Performing other installation steps.
The package kubernetes-helm wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): y
Downloading kubernetes-helm 64 bit
  from 'https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-windows-amd64.zip'
Progress: 100% - Completed download of C:\Users\shunlin\AppData\Local\Temp\chocolatey\kubernetes-helm\2.11.0\helm-v2.11.0-windows-amd64.zip (18.36 MB).
Download of helm-v2.11.0-windows-amd64.zip (18.36 MB) completed.
Hashes match.
Extracting C:\Users\shunlin\AppData\Local\Temp\chocolatey\kubernetes-helm\2.11.0\helm-v2.11.0-windows-amd64.zip to C:\ProgramData\chocolatey\lib\kubernetes-helm\tools...
C:\ProgramData\chocolatey\lib\kubernetes-helm\tools
 ShimGen has successfully created a shim for helm.exe
 ShimGen has successfully created a shim for tiller.exe
 The install of kubernetes-helm was successful.
  Software installed to 'C:\ProgramData\chocolatey\lib\kubernetes-helm\tools'
Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
  1. 安裝完成後, 執行命令 helm init --canary-image 初始化 Helm
$HELM_HOME has been configured at C:\Users\?????\.helm.
Warning: Tiller is already installed in the cluster.
(Use --client-only to suppress this message, or --upgrade to upgrade Tiller to the current version.)
Happy Helming!
  1. 使用命令 helm version 檢查 Helm 版本
PS C:\WINDOWS\system32> helm version
Client: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.11.0", GitCommit:"2e55dbe1fdb5fdb96b75ff144a339489417b146b", GitTreeState:"clean"}
  1. 使用命令 tiller, 安裝並啟動 tiller Server 端
PS C:\WINDOWS\system32> tiller
[main] 2018/10/24 13:40:12 Starting Tiller v2.11.0 (tls=false)
[main] 2018/10/24 13:40:12 GRPC listening on :44134
[main] 2018/10/24 13:40:12 Probes listening on :44135
[main] 2018/10/24 13:40:12 Storage driver is ConfigMap
[main] 2018/10/24 13:40:12 Max history per release is 0
  1. 使用命令 kubectl get deployments --all-namespaces , 確認 tiller 部署完成
PS C:\k8s> kubectl get deployments --all-namespaces
NAMESPACE     NAME                               DESIRED   CURRENT   UP-TO-DATE   AVAILABLE   AGE
docker        compose                            1         1         1            1           14d
docker        compose-api                        1         1         1            1           14d
kube-system   kube-dns                           1         1         1            1           14d
kube-system   tiller-deploy                      1         1         1            1           12m

以上便完成了 Helm 與 tiller 安裝初始化


參考資料:


上一篇
Day 22 - 使用永久性儲存 Persistent Volume
下一篇
Day 24 - 使用 Helm 部署應用程式到 Kubernetes
系列文
15 分鐘學習系列 - 第一次學 Kubernetes 就上手30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言