Kubernetes Helm入门指南
什么是Helm?这可不是暗黑破坏神里装备的名称:头盔,而是Kubernetes的一个包管理工具,用来简化Kubernetes应用的部署和管理。我们Helm和Kubernetes的关系,我们可以理解成yum和CentOS,apt-get和Ubuntu的关系。
Helm由两部分组成,客户端helm和服务端tiller。
其中tiller运行在Kubernetes集群上,管理chart,而客户端helm就是一个命令行工具,可在本地运行,一般运行在持续集成/持续交付的服务器上 。
下图是helm的架构图。
我们现在就来试用下helm。
首先安装helm客户端。
下载helm执行文件的压缩包:
wget -O helm.tar.gz https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz tar -xzf helm.tar.gz
解压完毕后,将helm文件移到目录/usr/local/bin/helm下面:
mv linux-amd64/helm /usr/local/bin/helm
给这个文件加上执行权限:
chmod +x /usr/local/bin/helm
首先使用-namespace参数指定使用的namespace,我例子里的命名空间是part-0110:
helm init --tiller-namespace part-0110 --service-account access
helm init --tiller-namespace part-0110 --service-account access
Creating /home/vagrant/.helm
Creating /home/vagrant/.helm/repository
Creating /home/vagrant/.helm/repository/cache
Creating /home/vagrant/.helm/repository/local
Creating /home/vagrant/.helm/plugins
Creating /home/vagrant/.helm/starters
Creating /home/vagrant/.helm/cache/archive
Creating /home/vagrant/.helm/repository/repositories.yaml
Adding stable repo with URL: https://kubernetes-charts.storage.googleapis.com
Adding local repo with URL: http://127.0.0.1:8879/charts
$HELM_HOME has been configured at /home/vagrant/.helm.
Tiller (the Helm server-side component) has been installed into your Kubernetes Cluster.
Please note: by default, Tiller is deployed with an insecure 'allow unauthenticated users' policy.
For more information on securing your installation see: https://docs.helm.sh/using_helm/#securing-your-helm-installation
Happy Helming!
从helm的init命令输出,我们可以观察到,该命令生成了大量和helm server交互所必须的repository。
现在可以使用helm version命令行参数查看helm客户端和服务器端的版本号:
helm version --tiller-connection-timeout=5 --tiller-namespace part-0110
vagrant@vagrant:~/.kube$ helm version --tiller-connection-timeout=5 --tiller-namespace part-0110
Client: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.9.1", GitCommit:"20adb27c7c5868466912eebdf6664e7390ebe710", GitTreeState:"clean"}
使用命令helm repo list查看helm仓库列表:
根据名称搜索helm chart:
helm search chaoskube
使用下面的命令行安装chart。命令行中的参数jerry可以根据需要改成你自己期望的名字。
helm install --name jerry stable/chaoskube --set namespaces=part-0110 --set rbac.serviceAccountName=access --tiller-namespace part-0110 --debug
下面是helm install命令的输出,供您参考:
vagrant@vagrant:~/.kube$ helm install --name jerry stable/chaoskube --set namespaces=part-0110 --set rbac.serviceAccountName=access --tiller-namespace part-0110 --debug
[debug] Created tunnel using local port: '36408'
[debug] SERVER: "127.0.0.1:36408"
[debug] Original chart version: ""
[debug] Fetched stable/chaoskube to /home/vagrant/.helm/cache/archive/chaoskube-0.10.0.tgz
[debug] CHART PATH: /home/vagrant/.helm/cache/archive/chaoskube-0.10.0.tgz
NAME: jerry
REVISION: 1
RELEASED: Thu Nov 15 16:37:19 2018
CHART: chaoskube-0.10.0
USER-SUPPLIED VALUES:
namespaces: part-0110
rbac:
serviceAccountName: access
COMPUTED VALUES:
affinity: {}
annotations: null
debug: false
dryRun: true
excludedDaysOfYear: null
excludedTimesOfDay: null
excludedWeekdays: null
image: quay.io/linki/chaoskube
imageTag: v0.10.0
interval: 10m
labels: null
minimumAge: 0s
name: chaoskube
namespaces: part-0110
nodeSelector: {}
priorityClassName: ""
rbac:
create: false
serviceAccountName: access
replicas: 1
resources: {}
timezone: UTC
tolerations: []
HOOKS:
MANIFEST:
Source: chaoskube/templates/deployment.yaml
apiVersion: apps/v1beta1
kind: Deployment
metadata:
name: jerry-chaoskube
labels:
app: chaoskube
heritage: "Tiller"
release: "jerry"
chart: chaoskube-0.10.0
spec:
replicas: 1
selector:
matchLabels:
app: chaoskube
release: jerry
template:
metadata:
labels:
app: chaoskube
heritage: "Tiller"
release: "jerry"
chart: chaoskube-0.10.0
spec:
containers:
- name: chaoskube
image: quay.io/linki/chaoskube:v0.10.0
args:
--interval=10m
--labels=
--annotations=
--namespaces=part-0110
--excluded-weekdays=
--excluded-times-of-day=
--excluded-days-of-year=
--timezone=UTC
--minimum-age=0s
resources:
{}
serviceAccountName: "access"
LAST DEPLOYED: Thu Nov 15 16:37:19 2018
NAMESPACE: part-0110
STATUS: DEPLOYED
RESOURCES:
==> v1beta1/Deployment
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
jerry-chaoskube 1 1 1 0 2s
==> v1/Pod(related)
NAME READY STATUS RESTARTS AGE
jerry-chaoskube-6689695476-kchtn 0/1 ContainerCreating 0 1s
NOTES:
chaoskube is running and will kill arbitrary pods every 10m.
You can follow the logs to see what chaoskube does:
POD=$(kubectl -n part-0110 get pods -l='release=jerry-chaoskube' --output=jsonpath='{.items[0].metadata.name}')
kubectl -n part-0110 logs -f $POD
You are running in dry-run mode. No pod is actually terminated.
使用helm list命令,现在就能查看到刚才安装的名为jerry的chart了。
helm list --tiller-namespace part-0110
使用helm命令查看这个chart的明细(类似kubectl describe pod XXX )
helm status jerry --tiller-namespace part-0110
上图也显示了自动生成的pod名称为jerry-chaoskube-6689695476-kchtn,可以用kubectl log命令查看其运行日志:
kubectl log jerry-chaoskube-6689695476-kchtn
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
转载于:https://www.cnblogs.com/sap-jerry/p/9998352.html
Kubernetes Helm入门指南相关推荐
- Kubernetes Ingress入门指南和实践练习
Ingress也是Kubernetes项目里的一种 API 对象,它公开了从集群外部到集群内Service的 HTTP 和 HTTPS 路由,这些路由由 Ingress 资源上定义的规则控制. int ...
- Kubernetes Pod入门指南
Pod是Kubernetes项目里定义的最小可调度单元,是Kubernetes对应用程序的抽象.在这篇文章里我将会介绍Kubernetes里Pod的基本概念,使用方式,生命周期以及如何使用Pod部署应 ...
- Serverless Kubernetes 快速入门指南
为什么80%的码农都做不了架构师?>>> 摘要: 5月,阿里云宣布推出Serverless Kubernetes服务.开发者可在5秒内创建集群.30秒部署应用上线.用户无需管理 ...
- helm v3.8.0 命令入门指南
文章目录 1. 条件 2. 安装 2.1 二进制版本安装 2.2 脚本安装 2.3 更多安装方式 3. 三大概念 4. 常用方法 4.1 'helm repo':使用存储库 4.2 'helm sea ...
- Kubernetes(K8S)入门到运维 ( 六) Helm与功能组件及证书年限
elm与功能性组件 为什么又来一个Helm? 在向K8S部署应用时,要依次部署Deployment.SVC等,步骤多且麻烦,而且随着越来越多的项目微服务化,复杂的应用在容器中部署以及管理就更为复杂了, ...
- 2021年最新 k8s安装部署步骤 kubernetes从入门到实践 K8S实战容器化迁移实战教程 K8S存储之Ceph分布式存储系统 K8S架构师实战指南
2021年最新 k8s安装部署步骤 kubernetes从入门到实践 K8S实战容器化迁移实战教程 K8S存储之Ceph分布式存储系统 K8S架构师实战指南
- Kubernetes入门指南-基础篇
Kubernetes入门指南-基础篇 基础入门 kubernetes简介 kubernetes是一个平台 kubernetes架构 kubernetes不是什么 核心组件 kubernetes基本概念 ...
- Steeltoe 2.4新增代码生成工具、全新入门指南等,助力.NET微服务开发
Steeltoe框架现可帮助.NET开发人员创建云原生应用.随着其功能的扩充,该框架越来越受欢迎,下载量达到580万(并且仍在增加),这其中大部分的功能创新都源自于用户反馈.社区贡献和.NET运行环境 ...
- 【K8S系列】深入解析 k8s:入门指南(一)
目录 序言 1.背景介绍 2.前情提要 2.1 架构对比 2.2 容器技术 2.3 容器技术的优点 2.4 容器编排 3 K8S介绍 3.1 K8S是什么 3.2 K8S设计思想 3.3 K8S的优势 ...
最新文章
- Vc2003可以直接跑quake3
- http长/短轮询和WebSocket 的介绍和比较
- raid重构原理_5个重构原理示例
- thinkpad s3 安装win8 kali双系统笔记
- MYSQL基础之centos 6下二进制安装mariadb
- autojs toast 可以改变字体颜色吗_喃喃札记 | 你真的需要一部pad做笔记吗?
- Java多线程基础总结
- 《恋上数据结构第1季》哈希表介绍以及从源码分析哈希值计算
- Python探索金庸小说世界
- 数学建模好学吗?半年带出几十位省奖和十几位国奖
- 花老湿学习OpenCV:Shi-Tomasi角点检测
- halcon修改图像的灰度值02
- 数据科学 IPython 笔记本 9.8 比较,掩码和布尔逻辑
- 杭州的旅游景点有哪些传说的民间故事
- 2021-2025年中国拜勒病治疗行业市场供需与战略研究报告
- 模式分解的无损连接性之深入剖析
- 无线地磁传感器更适合路边停车系统
- 湖南高校教师资格证笔试内容
- 淘宝精准库存接口获取商品ID下所有的sku精准库存
- 如何从Ubuntu软件存储库外部安装软件