首页 > 其他分享 >Kubernetes(K8S) helm 安装

Kubernetes(K8S) helm 安装

时间:2022-12-05 08:55:27浏览次数:61  
标签:Kubernetes k8smaster ui helm scope K8S root weave

Helm 是一个 Kubernetes 的包管理工具, 就像 Linux 下的包管理器, 如 yum/apt 等, 可以很方便的将之前打包好的 yaml 文件部署到 kubernetes 上。
Helm 有 3 个重要概念:

  • helm: 一个命令行客户端工具, 主要用于 Kubernetes 应用 chart 的创建、 打包、 发布和管理。
  • Chart: 应用描述, 一系列用于描述 k8s 资源相关文件的集合。
  • Release: 基于 Chart 的部署实体, 一个 chart 被 Helm 运行后将会生成对应的一个release; 将在 k8s 中创建出真实运行的资源对象。

在部署微服务项目时,可能有几十个服务,每个服务都有一套 yaml 文件,需要维护大量 yaml 文件,版本管理特别不方便
使用 helm 可以解决下列问题:

  • 可以把微服务中的几十个 yaml 作为一个整体管理
  • 实现 yaml 高效复用
  • 应用级别的版本管理,当前V3,回滚到V2

helm 2019年 V3版本,变化项

  • V3 版本删除 Tiller (架构变化)
  • Release 可以在不同命名空间重用
  • 将 Chart 推送到 docker 仓库中

安装

https://helm.sh/
https://helm.sh/zh/docs/intro/install/

下载 helm 安装压缩包,上传到 linux
解压 helm,把目录复制到 usr/bin 目录中
image

[root@k8smaster ~]# cd /opt/k8s/
[root@k8smaster k8s]# tar zxfv helm-v3.0.0-linux-amd64.tar.gz 
linux-amd64/
linux-amd64/helm
linux-amd64/README.md
linux-amd64/LICENSE
[root@k8smaster k8s]# mv ./linux-amd64/helm /usr/bin/
# 显示版本,安装完成
[root@k8smaster k8s]# helm version
version.BuildInfo{Version:"v3.0.0", GitCommit:"e29ce2a54e96cd02ccfce88bee4f58bb6e2a28b6", GitTreeState:"clean", GoVersion:"go1.13.4"}
[root@k8smaster k8s]# 

配置

添加仓库

# 添加 仓库
[root@k8smaster ~]# helm repo add stable http://mirror.azure.cn/kubernetes/charts
"stable" has been added to your repositories
# 添加 阿里云仓库
[root@k8smaster ~]# helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
"aliyun" has been added to your repositories
# 查看
[root@k8smaster ~]# helm repo list
NAME    URL
stable  http://mirror.azure.cn/kubernetes/charts
aliyun  https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
# 更新
[root@k8smaster ~]# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "aliyun" chart repository
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈ Happy Helming!⎈ 
# 删除阿里云
[root@k8smaster ~]# helm repo remove aliyun
"aliyun" has been removed from your repositories
[root@k8smaster ~]# helm repo list
NAME    URL
stable  http://mirror.azure.cn/kubernetes/charts
[root@k8smaster ~]# 

部署应用

# 查找 chart
[root@k8smaster ~]# helm search repo weave
NAME                    CHART VERSION   APP VERSION     DESCRIPTION                                       
stable/weave-cloud      0.3.9           1.4.0           DEPRECATED - Weave Cloud is a add-on to Kuberne...
stable/weave-scope      1.1.12          1.12.0          DEPRECATED - A Helm chart for the Weave Scope c...
# 查看 chrt 信息
[root@k8smaster ~]# helm show chart stable/weave-scope
apiVersion: v1
appVersion: 1.12.0
deprecated: true
description: DEPRECATED - A Helm chart for the Weave Scope cluster visualizer.
home: https://www.weave.works/oss/scope/
icon: https://avatars1.githubusercontent.com/u/9976052?s=64
keywords:
- containers
- dashboard
- monitoring
name: weave-scope
sources:
- https://github.com/weaveworks/scope
version: 1.1.12
# 安装,名字叫 ui
[root@k8smaster ~]# helm install ui stable/weave-scope
NAME: ui
LAST DEPLOYED: Mon Nov 28 13:15:05 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
You should now be able to access the Scope frontend in your web browser, by
using kubectl port-forward:

kubectl -n default port-forward $(kubectl -n default get endpoints \
ui-weave-scope -o jsonpath='{.subsets[0].addresses[0].targetRef.name}') 8080:4040

then browsing to http://localhost:8080/.
For more details on using Weave Scope, see the Weave Scope documentation:

https://www.weave.works/docs/scope/latest/introducing/
# 查看列表
[root@k8smaster ~]# helm list
NAME    NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION
ui      default         1               2022-11-28 13:15:05.404335352 +0800 CST deployed        weave-scope-1.1.12      1.12.0 # 查看发布状态
[root@k8smaster ~]# helm status ui
NAME: ui
LAST DEPLOYED: Mon Nov 28 13:15:05 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
You should now be able to access the Scope frontend in your web browser, by
using kubectl port-forward:

kubectl -n default port-forward $(kubectl -n default get endpoints \
ui-weave-scope -o jsonpath='{.subsets[0].addresses[0].targetRef.name}') 8080:4040

then browsing to http://localhost:8080/.
For more details on using Weave Scope, see the Weave Scope documentation:

https://www.weave.works/docs/scope/latest/introducing/
# 查看服务 当前是不暴露端口的
[root@k8smaster ~]# kubectl get svc
NAME             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
javademo1        NodePort    10.106.43.46   <none>        8111:31452/TCP   40d
kubernetes       ClusterIP   10.96.0.1      <none>        443/TCP          45d
nginx            NodePort    10.103.87.81   <none>        80:30339/TCP     45d
nginx-nfs        NodePort    10.99.84.9     <none>        80:30205/TCP     19d
ui-weave-scope   ClusterIP   10.101.4.212   <none>        80/TCP           3m19s
# 修改 ui-weave-scpoe 暴露端口
[root@k8smaster ~]# kubectl edit svc ui-weave-scope
#  type: ClusterIP =>  改成 type: NodePort
service/ui-weave-scope edited
# 再次查看,暴露了 30690 端口
[root@k8smaster ~]# kubectl get svc
NAME             TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)          AGE
javademo1        NodePort    10.106.43.46   <none>        8111:31452/TCP   40d
kubernetes       ClusterIP   10.96.0.1      <none>        443/TCP          45d
nginx            NodePort    10.103.87.81   <none>        80:30339/TCP     45d
nginx-nfs        NodePort    10.99.84.9     <none>        80:30205/TCP     19d
ui-weave-scope   NodePort    10.101.4.212   <none>        80:30690/TCP     5m26s
# 删除 ui-weave-scope
[root@k8smaster ~]# kubectl delete deployment ui-weave-scope
[root@k8smaster ~]# kubectl delete svc ui-weave-scope

测试
image

标签:Kubernetes,k8smaster,ui,helm,scope,K8S,root,weave
From: https://www.cnblogs.com/vipsoft/p/16931552.html

相关文章

  • K8S-service介绍
    Service介绍在kubernetes中,pod是应用程序的载体,我们可以通过pod的ip来访问应用程序,但是pod的ip地址不是固定的,这也就意味着不方便直接采用pod的ip对服务进行访问。为了解......
  • k8s高级存储(PV、PVC)
    高级存储前面已经学习了使用NFS提供存储,此时就要求用户会搭建NFS系统,并且会在yaml配置nfs。由于kubernetes支持的存储系统有很多,要求客户全都掌握,显然不现实。为了能够屏......
  • Kubeadm高可用安装k8s集群-补充说明
    1.1k8s1.24管理用户无token处理1.24版本及以上关闭了自动生成admin-user-token的配置[root@k8s-master01dashboard]#kubectl-nkube-systemgetsecret|grepadmi......
  • Kubernetes监控手册04-监控Kube-Proxy
    简介首先,请阅读文章《​​Kubernetes监控手册01-体系介绍​​》,回顾一下Kubernetes架构,Kube-Proxy是在所有工作负载节点上的。Kube-Proxy默认暴露两个端口,10249用于暴露......
  • k8s源码分析7-API核心服务Authorization的认证及鉴权
    一、Authentication认证本节重点总结:Authentication的目的Kubernetes使用身份认证插件利用下面的策略来认证API请求的身份客户端证书持有者令牌(BearerToke......
  • Kubernetes 的 NameSpace 无法删除应该怎么办?
    概述有时候我们操作不规范,或者删除的先后顺序有问题,或者某项关键服务没有启动,导致Kubernetes经常会出现无法删除NameSpace的情况。这种情况下我们应该怎么办?规范删除流......
  • Kubernetes 的 NameSpace 无法删除应该怎么办?
    概述有时候我们操作不规范,或者删除的先后顺序有问题,或者某项关键服务没有启动,导致Kubernetes经常会出现无法删除NameSpace的情况。这种情况下我们应该怎么办?规范删除......
  • 基于jenkins+kubernetes的cicd流程实践三:清除镜像定时任务
    6.定时清除历史镜像:万里长征的最后一步收尾工作,换一种更“原生”的玩法,找一找新感觉,手搓走起.....参考:https://github.com/kubernetes-sigs/cri-tools/blob/master/docs/......
  • 基于jenkins+kubernetes的cicd流程实践一:环境搭建及方案原理
    1.基础环境:Centos7.9,kubernetes:v1.21.5node-1@112(master):docker,containerd,harbornginx(80),git,etcdnode-2@109(master/worker):docker,containerd,ingress_nginx(80),etcd,glusterfs......
  • 基于jenkins+kubernetes的cicd流程实践二:微服务迁移脚本
    5.web层服务迁移:​ (1)项目启动脚本:start.sh#!/bin/bashsrv_name="goods_web_main"chmod+x./${srv_name}ifpgrep-x${srv_name};thenecho"${srv_name}isr......