zoukankan      html  css  js  c++  java
  • k8s~helm3更方便的部署

    上级讲了helm2的安装,并且在安装过程中可能会出现问题,主要是与k8s版本冲突的问题,而最新的helm3对整个helm的架构都有了一个改进,它只有一个客户端的helm程序,由它进行连接k8s集群,完成对charts的部署工作。

    下载helm3

    https://get.helm.sh/helm-v3.0.0-linux-amd64.tar.gz
    

    查看配置信息

    [root@i-pcwovafu bin]# helm env
    HELM_NAMESPACE="default"
    HELM_KUBECONTEXT=""
    HELM_BIN="helm"
    HELM_DEBUG="false"
    HELM_PLUGINS="/root/.local/share/helm/plugins"
    HELM_REGISTRY_CONFIG="/root/.config/helm/registry.json"
    HELM_REPOSITORY_CACHE="/root/.cache/helm/repository"
    HELM_REPOSITORY_CONFIG="/root/.config/helm/repositories.yaml"
    

    添加公用的仓库

    helm repo add stable http://mirror.azure.cn/kubernetes/charts
    helm repo add aliyun https://kubernetes.oss-cn-hangzhou.aliyuncs.com/charts 
    helm repo update
    

    指定对应的k8s集群

    这一步非常关键,它是helm与k8s通讯的保证,这一步就是把k8s环境变量KUBECONFIG进行配置

    export KUBECONFIG=/root/.kube/config #可以写到/etc/profile里
    

    查询一个charts

    [root@i-pcwovafu ~]# helm search hub  nginx
    URL                                                     CHART VERSION   APP VERSION     DESCRIPTION
    https://hub.helm.sh/charts/choerodon/nginx-file...      0.1.0           1.13.5-alpine   A Helm chart for Kubernetes
    https://hub.helm.sh/charts/cloudposse/nginx-ing...      0.1.8                           A Helm chart for Nginx Ingress
    https://hub.helm.sh/charts/cloudposse/nginx-def...      0.5.0                           A Helm chart for nginx-default-backend to be us...
    https://hub.helm.sh/charts/cloudposse/fail-whale        0.1.1                           A Helm chart that provides a mainte
    

    构建一个nginx的用例

     helm create nginx
     helm nignx-demo ./nginx
    

    查询我们的nginx pod

    [root@i-pcwovafu bin]# rancher kubectl get pods -n default
    NAME                         READY   STATUS    RESTARTS   AGE
    web-nginx-858f7d9cc5-hlhkj   1/1     Running   0          2m14s
    

    也可以使用helm命令来查看

    [root@i-pcwovafu bin]# helm list
    NAME            NAMESPACE       REVISION        UPDATED                                 STATUS         CHART            APP VERSION
    web-nginx       default         1               2020-04-07 17:09:53.480335758 +0800 CST deployed       nginx-0.1.0      1.16.0
    

    这样一个最简单的helm应用就建立好了!

  • 相关阅读:
    LeetCode 326. Power of Three
    LeetCode 324. Wiggle Sort II
    LeetCode 322. Coin Change
    LeetCode 321. Create Maximum Number
    LeetCode 319. Bulb Switcher
    LeetCode 318. Maximum Product of Word Lengths
    LeetCode 310. Minimum Height Trees (DFS)
    个人站点大开发!--起始篇
    LeetCode 313. Super Ugly Number
    LeetCode 309. Best Time to Buy and Sell Stock with Cooldown (DP)
  • 原文地址:https://www.cnblogs.com/lori/p/12654585.html
Copyright © 2011-2022 走看看