nexus3 安装helm
介绍 (Introduction)
Helm is a package manager for Kubernetes that allows developers and operators to more easily configure and deploy applications on Kubernetes clusters.
Helm是Kubernetes的软件包管理器,使开发人员和操作员可以更轻松地在Kubernetes集群上配置和部署应用程序。
In this tutorial, you will set up Helm 3 and use it to install, reconfigure, rollback, and delete an instance of the Kubernetes Dashboard application. The dashboard is an official web-based Kubernetes GUI.
在本教程中,您将设置Helm 3并将其用于安装,重新配置,回滚和删除Kubernetes Dashboard应用程序的实例。 该仪表板是基于Web的官方Kubernetes GUI。
For a conceptual overview of Helm and its packaging ecosystem, please read our article, An Introduction to Helm.
有关Helm及其包装生态系统的概念性概述,请阅读我们的文章Helm简介 。
先决条件 (Prerequisites)
For this tutorial you will need:
对于本教程,您将需要:
A Kubernetes cluster with role-based access control (RBAC) enabled. Helm 3.1 supports clusters from versions 1.14 to 1.17. For further information check the Helm releases page.
启用了基于角色的访问控制(RBAC)的Kubernetes集群。 Helm 3.1支持从版本1.14到1.17的群集。 有关更多信息,请查看“ Helm版本”页面。
The
kubectlcommand-line tool installed on your local machine, configured to connect to your cluster. You can read more about installingkubectlin the official documentation.安装在本地计算机上的
kubectl命令行工具,配置为连接到集群。 您可以在官方文档中阅读有关安装kubectl更多信息。You can test your connectivity with the following command:
您可以使用以下命令测试连接性:
- kubectl cluster-info kubectl集群信息
If you see no errors, you’re connected to the cluster. If you access multiple clusters with
kubectl, be sure to verify that you’ve selected the correct cluster context:如果没有看到错误,则说明您已连接到集群。 如果您使用
kubectl访问多个集群,kubectl确保验证您选择了正确的集群上下文:- kubectl config get-contexts kubectl配置获取上下文
OutputCURRENT NAME CLUSTER AUTHINFO NAMESPACE * do-fra1-helm3-example do-fra1-helm3-example do-fra1-helm3-example-adminIn this example the asterisk (
*) indicates that we are connected to thedo-fra1-helm3-examplecluster. To switch clusters run:在此示例中,星号(
*)表示我们已连接到do-fra1-helm3-example集群。 要切换集群,请运行:- kubectl config use-context context-name kubectl配置使用上下文上下文名称
When you are connected to the correct cluster, continue to Step 1 to begin installing Helm.
连接到正确的群集后,请继续执行步骤1以开始安装Helm。
第1步-安装头盔 (Step 1 — Installing Helm)
First, you’ll install the helm command-line utility on your local machine. Helm provides a script that handles the installation process on MacOS, Windows, or Linux.
首先,您将在本地计算机上安装helm命令行实用程序。 Helm提供了一个脚本,用于处理MacOS,Windows或Linux上的安装过程。
Change to a writable directory and download the script from Helm’s GitHub repository:
切换到可写目录,然后从Helm的GitHub存储库下载脚本:
- cd /tmp cd / tmp
- curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
Make the script executable with chmod:
使用chmod使脚本可执行:
- chmod u+x get_helm.sh chmod u + x get_helm.sh
You can use your favorite text editor to open the script and inspect it to make sure it’s safe. When you are satisfied, run it:
您可以使用自己喜欢的文本编辑器打开脚本并对其进行检查以确保其安全。 当您满意时,运行它:
- ./get_helm.sh ./get_helm.sh
You may be prompted for your password. Provide it and press ENTER to continue.
可能会提示您输入密码。 提供它,然后按ENTER继续。
The output will look like this:
输出将如下所示:
Output
Downloading https://get.helm.sh/helm-v3.1.2-linux-amd64.tar.gz
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm
Now that you’ve got Helm installed, you’re ready to use Helm to install your first chart.
既然已经安装了Helm,那么就可以使用Helm安装第一个图表了。
第2步-安装舵图 (Step 2 — Installing a Helm Chart)
Helm software packages are called charts. There is a curated chart repository called stable, mostly consisting of common charts, which you can see in their GitHub repo. Helm does not come preconfigured for it, so you’ll need to manually add it. Then, as an example, you are going to install the Kubernetes Dashboard.
Helm软件包称为图表 。 有一个称为稳定的精选图表存储库,主要由常见图表组成,您可以在其GitHub repo中看到它们 。 Helm尚未预先配置,因此您需要手动添加。 然后,作为示例,您将安装Kubernetes Dashboard 。
Add the stable repo by running:
通过运行以下命令添加stable仓库:
- helm repo add stable https://kubernetes-charts.storage.googleapis.com 舵库添加稳定的https://kubernetes-charts.storage.googleapis.com
The output will be:
输出将是:
Output
"stable" has been added to your repositories
Then, use helm to install the kubernetes-dashboard package from the stable repo:
然后,使用helm从stable的kubernetes-dashboard安装kubernetes-dashboard软件包:
- helm install dashboard-demo stable/kubernetes-dashboard --set rbac.clusterAdminRole=true 舵机安装仪表板演示稳定/ kubernetes仪表板--set rbac.clusterAdminRole = true
The --set parameter lets you to customize chart variables, which the chart exposes to allow you to customize its configuration. Here, you set the rbac.clusterAdminRole variable to true to grant the Kubernetes Dashboard access to your whole cluster.
使用--set参数可以自定义统计图变量 ,统计图将显示这些变量以自定义其配置。 在这里,您将rbac.clusterAdminRole变量设置为true以授予Kubernetes Dashboard对您整个集群的访问权限。
The output will look like:
输出将如下所示:
Output
NAME: dashboard-demo
LAST DEPLOYED: Tue Mar 31 15:04:19 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
...
Notice the NAME line, highlighted in the above example output. In this case, you specified the name dashboard-demo. This is the name of the release. A Helm release is a single deployment of one chart with a specific configuration. You can deploy multiple releases of the same chart, each with its own configuration.
请注意在上面的示例输出中突出显示的NAME行。 在这种情况下,您指定了名称dashboard-demo 。 这是版本的名称。 Helm 版本是具有特定配置的单个图表的单个部署。 您可以部署同一图表的多个版本,每个版本都有其自己的配置。
You can list all the releases in the cluster:
您可以列出集群中的所有发行版:
- helm list 掌舵清单
The output will be similar to this:
输出将类似于以下内容:
Output
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
dashboard-demo default 1 2020-03-31 15:04:19.324774799 +0000 UTC deployed kubernetes-dashboard-1.10.1 1.10.1
You can now use kubectl to verify that a new service has been deployed on the cluster:
现在,您可以使用kubectl来验证是否已在集群上部署了新服务:
- kubectl get services kubectl获得服务
The output will look like this:
输出将如下所示:
Output
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
dashboard-demo-kubernetes-dashboard ClusterIP 10.245.115.214 <none> 443/TCP 4m44s
kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 19m
Notice that by default, the service name corresponding to the release is a combination of the Helm release name and the chart name.
请注意,默认情况下,与发行版相对应的服务名称是Helm发行版名称和图表名称的组合。
Now that you’ve deployed the application, you’ll use Helm to change its configuration and update the deployment.
部署了应用程序之后,将使用Helm更改其配置并更新部署。
第3步-更新发行版 (Step 3 — Updating a Release)
The helm upgrade command can be used to upgrade a release with a new or updated chart, or update its configuration options (variables).
helm upgrade命令可用于使用新的或更新的图表来升级发行版,或更新其配置选项(变量)。
You’re going to make a simple change to the dashboard-demo release to demonstrate the update and rollback process: you’ll update the name of the dashboard service to just kubernetes-dashboard, instead of dashboard-demo-kubernetes-dashboard.
您将对dashboard-demo版本进行简单更改,以演示更新和回滚过程:您将仪表板服务的名称更新为kubernetes-dashboard ,而不是dashboard-demo-kubernetes-dashboard 。
The kubernetes-dashboard chart provides a fullnameOverride configuration option to control the service name. To rename the release, run helm upgrade with this option set:
kubernetes-dashboard图表提供了fullnameOverride配置选项来控制服务名称。 要重命名版本,请使用以下选项运行helm upgrade :
helm upgrade dashboard-demo stable/kubernetes-dashboard --set fullnameOverride="kubernetes-dashboard" --reuse-values
舵升级仪表板演示稳定/ kubernetes-dashboard --set fullnameOverride =“ kubernetes-dashboard” --reuse-values
By passing in the --reuse-values argument, you make sure that chart variables you’ve previously set do not get reset by the upgrade process.
通过传递--reuse-values参数,可以确保先前set图表变量不会在升级过程中被重置。
You’ll see output similar to the initial helm install step.
您将看到类似于初始helm install步骤的输出。
Check if your Kubernetes services reflect the updated values:
检查您的Kubernetes服务是否反映了更新的值:
- kubectl get services kubectl获得服务
The output will look like the following:
输出将如下所示:
Output
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubernetes ClusterIP 10.245.0.1 <none> 443/TCP 38m
kubernetes-dashboard ClusterIP 10.245.49.157 <none> 443/TCP 8s
Notice that the service name has been updated to the new value.
请注意,服务名称已更新为新值。
Note: At this point you may want to actually load the Kubernetes Dashboard in your browser and check it out. To do so, first run the following command:
注意:此时,您可能需要在浏览器中实际加载Kubernetes仪表板并将其检出。 为此,首先运行以下命令:
- kubectl proxy kubectl代理
This creates a proxy that lets you access remote cluster resources from your local computer. Based on the previous instructions, your dashboard service is named kubernetes-dashboard and it’s running in the default namespace. You may now access the dashboard at the following URL:
这将创建一个代理,使您可以从本地计算机访问远程群集资源。 根据前面的说明,您的仪表板服务名为kubernetes-dashboard并且在default名称空间中运行。 您现在可以通过以下URL访问仪表板:
http://localhost:8001/api/v1/namespaces/default/services/https:kubernetes-dashboard:https/proxy/
Instructions for actually using the dashboard are out of scope for this tutorial, but you can read the official Kubernetes Dashboard docs for more information.
实际使用仪表板的说明超出了本教程的范围,但是您可以阅读Kubernetes Dashboard官方文档以获取更多信息。
Next, you’ll have a look at Helm’s ability to roll back and delete releases.
接下来,您将了解Helm的回滚和删除发行版的功能。
步骤4 —回滚并删除发行版 (Step 4 — Rolling Back and Deleting a Release)
When you updated the dashboard-demo release in the previous step, you created a second revision of the release. Helm retains all the details of previous releases in case you need to roll back to a prior configuration or chart.
在上一步中更新了dashboard-demo版本时,您创建了该版本的第二个版本 。 如果您需要回滚到先前的配置或图表,Helm会保留先前版本的所有详细信息。
Use helm list to inspect the release again:
使用helm list再次检查发布:
- helm list 掌舵清单
You’ll see the following output:
您将看到以下输出:
Output
NAME REVISION UPDATED STATUS CHART NAMESPACE
dashboard-demo 2 Wed Aug 8 20:13:15 2018 DEPLOYED kubernetes-dashboard-0.7.1 default
The REVISION column tells you that this is now the second revision.
REVISION列告诉您这是第二个修订版。
Use helm rollback to roll back to the first revision:
使用helm rollback可以回滚到第一个修订版:
helm rollback dashboard-demo 1
头盔回滚仪表板演示 1
You should see the following output, indicating that the rollback succeeded:
您应该看到以下输出,指示回滚成功:
Output
Rollback was a success! Happy Helming!
At this point, if you run kubectl get services again, you will notice that the service name has changed back to its previous value. Helm has re-deployed the application with revision 1’s configuration.
此时,如果再次运行kubectl get services ,您将注意到服务名称已更改回其先前的值。 Helm已使用修订版1的配置重新部署了该应用程序。
Helm releases can be deleted with the helm delete command:
可以使用helm delete命令删除Helm版本:
helm delete dashboard-demo
删除仪表板演示
The output will be:
输出将是:
Output
release "dashboard-demo" uninstalled
You can try listing Helm releases:
您可以尝试列出Helm版本:
- helm list 掌舵清单
You’ll see that there are none:
您会看到没有:
Output
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
Now the release has been truly deleted, and you can reuse the release name.
现在,该版本已被真正删除,您可以重复使用该版本的名称。
结论 (Conclusion)
In this tutorial, you installed the helm command-line tool and explored installing, upgrading, rolling back, and deleting Helm charts and releases by managing the kubernetes-dashboard chart.
在本教程中,您安装了helm命令行工具,并通过管理kubernetes-dashboard图表探索了安装,升级,回滚和删除Helm图表和发行版。
For more information about Helm and Helm charts, please see the official Helm documentation.
有关Helm和Helm图表的更多信息,请参阅官方Helm文档 。
nexus3 安装helm
本文档介绍了如何安装和使用Helm 3,这是一个针对Kubernetes的包管理器,用于简化应用的部署和管理。通过设置Helm 3,您将学习如何安装、更新、回滚和删除Kubernetes Dashboard应用实例。

被折叠的 条评论
为什么被折叠?



