zoukankan      html  css  js  c++  java
  • k8s-创建自定义chart及部署efk-二十五

    一、chart的结构

    (1)更改helm为阿里云仓库源

    [root@master helm]# helm repo remove stable
    "stable" has been removed from your repositories
    
    [root@master helm]# helm repo add stable https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
    "stable" has been added to your repositories
    
    [root@master helm]# helm repo list
    NAME         URL                                                        
    local        http://127.0.0.1:8879/charts                               
    incubator    https://kubernetes-charts-incubator.storage.googleapis.com/
    stable       https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts
    
    #更新
    [root@master helm]# helm repo update
    Hang tight while we grab the latest from your chart repositories...
    ...Skip local chart repository
    ...Successfully got an update from the "incubator" chart repository
    ...Successfully got an update from the "stable" chart repository
    Update Complete. ⎈ Happy Helming!⎈

    (2)

    [root@master helm]# pwd
    /root/manifests/helm
    [root@master helm]# helm fetch stable/redis    #获取chart,会得到一个压缩包
    
    [root@master helm]# tar zxf redis-6.4.3.tgz
    
    [root@master helm]# ls
    redis  redis-6.4.3.tgz  tiller-rbac.yaml
    
    #chart目录结构
    [root@master helm]# tree redis
    redis
    ├── Chart.yaml            #chart元数据描述信息(版本...)
    ├── ci
    │   ├── default-values.yaml
    │   ├── dev-values.yaml
    │   ├── production-values.yaml
    │   ├── redisgraph-module-values.yaml
    │   └── redis-lib-values.yaml
    ├── README.md
    ├── templates            #资源定义清单模板文件
    │   ├── configmap.yaml
    │   ├── health-configmap.yaml
    │   ├── _helpers.tpl
    │   ├── metrics-deployment.yaml
    │   ├── metrics-prometheus.yaml
    │   ├── metrics-svc.yaml
    │   ├── networkpolicy.yaml
    │   ├── NOTES.txt
    │   ├── redis-master-statefulset.yaml
    │   ├── redis-master-svc.yaml
    │   ├── redis-rolebinding.yaml
    │   ├── redis-role.yaml
    │   ├── redis-serviceaccount.yaml
    │   ├── redis-slave-deployment.yaml
    │   ├── redis-slave-svc.yaml
    │   └── secret.yaml
    ├── values-production.yaml
    └── values.yaml            #为 templates中的资源定义清单设置自定义属性值
    #其他目录结构
    requirements.yaml        #当前chart是否依赖其他chart,这个文件是可选的。
    charts/               #里面放置的是当前chart所要依赖的其他chart,这个是可选的。
    
    #可以通过chart官方手册,来了解以上每项的详细含义: 
    https://docs.helm.sh/developing_charts/#charts

    二、用helm生成基础chart示例性文件

    (1)

    [root@master helm]# helm create myapp
    Creating myapp
    
    [root@master helm]# ls |grep myapp
    myapp
    
    [root@master helm]# tree myapp/
    myapp/
    ├── charts
    ├── Chart.yaml
    ├── templates
    │   ├── deployment.yaml
    │   ├── _helpers.tpl
    │   ├── ingress.yaml
    │   ├── NOTES.txt
    │   └── service.yaml
    └── values.yaml
    
    #可以自己修改每个文件里的值,然后做语法检查
    [root@master helm]# helm lint myapp
    ==> Linting myapp
    [INFO] Chart.yaml: icon is recommended
    
    1 chart(s) linted, no failures
    
    #打包
    [root@master helm]# helm package myapp/
    Successfully packaged chart and saved it to: /root/manifests/helm/myapp-0.0.1.tgz
    
    [root@master helm]# ls |grep myapp
    myapp
    myapp-0.0.1.tgz

    (2)启动本地仓库,并应用

    [root@master helm]# helm repo list
    NAME      URL                                             
    stable    https://kubernetes-charts.storage.googleapis.com
    local     http://127.0.0.1:8879/charts  
    
    #启动本地仓库
    [root@master helm]# helm serve 
    Regenerating index. This may take a moment.
    Now serving you on 127.0.0.1:8879
    
    #查看,可见myapp已经自动保存在仓库中了
    [root@master ~]# helm search myapp
    NAME           CHART VERSION    APP VERSION    DESCRIPTION                            
    local/myapp    0.0.1            1.0            A Helm chart for Kubernetes myapp chart
    
    #如果定义的没问题,就可以部署了
    [root@master ~]# helm install --name myapp1 local/myapp
    
    #删除
    [root@master ~]# helm delete --purge myapp1

    三、EFK日志系统

    (1)添加incubator源

    [root@master ~]# helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
    "incubator" has been added to your repositories
    
    [root@master ~]# helm repo list
    NAME         URL                                                        
    
  • 相关阅读:
    通过在vs中”程序包管理器控制台“的输入命令来实现下载和安装所需版本的Mysql.data和Mysql.Data.Entity.EF6
    ireport使用问题
    mysql数据库迁移到达梦数据库
    Idea配置热部署
    阿里云双12年终钜惠
    移动端弹性布局方案lib-flexible实践
    阿里云服务器2折起
    javascript百度地图使用(根据地名定位、根据经纬度定位)
    js拖拽上传图片
    javascript xml转json
  • 原文地址:https://www.cnblogs.com/weiyiming007/p/10642375.html
Copyright © 2011-2022 走看看