zoukankan      html  css  js  c++  java
  • Helm

    helm
    类似yum

    helm下载的是配置清单文件


    核心术语:
    Chart:一个helm程序包;
    Repository:Charts仓库,https/http服务器;
    Release:特定的Chart部署于目标集群上的一个实例;
    Chart -> Config -> Release
    程序架构:
    helm:客户端,管理本地的Chart仓库,管理Chart, 与Tiller服务器交互,发送Chart,实例安装、查询、卸载等
    操作
    Tiller:服务端,接收helm发来的Charts与Config,合并生成relase;

    #安装helm
    github
    https://github.com/helm/helm
    
    #下载
    wget https://storage.googleapis.com/kubernetes-helm/helm-v2.11.0-linux-amd64.tar.gz
    #解压
    tar xf helm-v2.9.1-linux-amd64.tar.gz 
    #查看
    [root@k8s-m heml]# cd linux-arm64/
    [root@k8s-m linux-arm64]# ll
    总用量 66876
    -rwxr-xr-x 1 root root 34395552 12月 20 07:09 helm
    -rw-r--r-- 1 root root    11343 12月 20 07:11 LICENSE
    -rw-r--r-- 1 root root     3138 12月 20 07:11 README.md
    -rwxr-xr-x 1 root root 34063008 12月 20 07:10 tiller
    #
    [root@k8s-m linux-arm64]#  cp helm  /usr/bin/
    
    #查看
    helm  -h
    
    
    
    RBAC配置文件示例:
    https://github.com/helm/helm/blob/master/docs/rbac.md
    
    #创建角色与rbac授权
    [root@k8s-m linux-amd64]# cat  rbac-config.yaml
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: tiller
      namespace: kube-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: tiller
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: cluster-admin
    subjects:
      - kind: ServiceAccount
        name: tiller
        namespace: kube-system
    #导入
     kubectl  apply -f rbac-config.yaml 
    #查看
    [root@k8s-m linux-amd64]# kubectl  get sa -n kube-system|grep tiller
    tiller                               1         47s
    #helm初始化
    helm init --service-account tiller
    

    [root@k8s-m linux-amd64]# helm init --service-account tiller
    Creating /root/.helm
    Creating /root/.helm/repository
    Creating /root/.helm/repository/cache
    Creating /root/.helm/repository/local
    Creating /root/.helm/plugins
    Creating /root/.helm/starters
    Creating /root/.helm/cache/archive
    Creating /root/.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 /root/.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!

    #测试使用

    [root@k8s-m linux-amd64]# helm search redis
    NAME CHART VERSION APP VERSION DESCRIPTION
    stable/prometheus-redis-exporter 1.0.0 0.22.1 Prometheus exporter for Redis metrics
    stable/redis 5.1.3 4.0.12 Open source, advanced key-value store. It is of...
    stable/redis-ha 3.0.3 4.0.11 Highly available Kubernetes implementation of R...
    stable/sensu 0.2.3 0.28 Sensu monitoring framework backed by the Redis ...

    官方可用的Chart列表:
    https://hub.kubeapps.com/
    
    helm常用命令:(使用和yum类似)
    	release管理:
    	install #下
    	delete  #删除
    	upgrade/rollback   #更新与回滚
    	list  #列出下载列表
    	history:release的历史信息;
    	status:获取release状态信息;
    	inspect  #查看详细信息
    chart管理:
    	create 
    	fetch
    	get
    	inspect
    	package
    	verify
    	incubator
    

      

    helm3.2

    #1、下载helm3.2
    wget https://get.helm.sh/helm-v3.2.0-linux-amd64.tar.gz
    #2、解压
    tar xf helm-v3.2.0-linux-amd64.tar.gz
    #3、复制helm
    cd linux-amd64/
    cp helm  /usr/bin/
    #4、配置rbac
    [root@k8s-m linux-amd64]# cat  rbac-config.yaml
    apiVersion: v1
    kind: ServiceAccount
    metadata:
      name: tiller
      namespace: kube-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: tiller
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: cluster-admin
    subjects:
      - kind: ServiceAccount
        name: tiller
        namespace: kube-system
    #5、导入
     kubectl  apply -f rbac-config.yaml
    #6、配置chart仓库
    #官方
    helm repo add stable https://kubernetes-charts.storage.googleapis.com
    #阿里云
    helm repo add aliyuncs https://apphub.aliyuncs.com
    #7、测试
    [root@master linux-amd64]# helm search repo  kibana
    NAME               CHART VERSION    APP VERSION    DESCRIPTION                                       
    aliyuncs/kibana    5.0.6            7.5.2          Kibana is an open source, browser based analyti...
    #8、安装测试
    [root@master linux-amd64]# helm  install aliyuncs/kibana  --generate-name
    NAME: kibana-1588900208
    LAST DEPLOYED: Fri May  8 09:10:09 2020
    NAMESPACE: default
    STATUS: deployed
    REVISION: 1
    NOTES:
    ######################################################################################################
    ### ERROR: You did not provide the Elasticsearch external host or port in your 'helm install' call ###
    ######################################################################################################
    
    Complete your Kibana deployment by running:
    
      helm upgrade kibana-1588900208 bitnami/kibana 
        --set elasticsearch.hosts[0]=YOUR_ES_HOST,elasticsearch.port=YOUR_ES_PORT
    
    Replacing "YOUR_ES_HOST" and "YOUR_ES_PORT" placeholders by the proper values of your Elasticsearch deployment.
    [root@master linux-amd64]# helm  list 
    NAME             	NAMESPACE	REVISION	UPDATED                                	STATUS  	CHART       	APP VERSION
    kibana-1588900208	default  	1       	2020-05-08 09:10:09.409998058 +0800 CST	deployed	kibana-5.0.6	7.5.2      
    
    
    
    
  • 相关阅读:
    Django + uWSGI + Nginx 实现生产环境部署
    面试题(一)
    Python基础之路
    Tornado之实例和扩展
    Scrapy源码研究前戏
    算法之基本概念
    RedHat6.2系统安装ipvsadm+keepalived
    oracle11G 同时支持IPV4和IPV6配置
    redhat6.5 安装oracle11G
    python解析字体反爬
  • 原文地址:https://www.cnblogs.com/zhangb8042/p/10205551.html
Copyright © 2011-2022 走看看