Kubernetes 有許多的 yaml 檔案, 當使用時間一段時間後, 會變得複雜且不易維護, 因此本篇筆記將介紹 Helm, Helm 是一個可以安裝與管理 Kubernetes 應用程式的工具, 我們可以將 Helm 視為是 Kubernetes 的 package manager. 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
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).
$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!
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"}
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
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 安裝初始化