Helm

HELM #

helm/helm Github stars Language Last Tag Last commit

Helm is the best way to find, share, and use software built for Kubernetes.

官网:https://helm.sh

Helm is a tool for managing Charts. Charts are packages of pre-configured Kubernetes resources.

Use Helm to:

  • Find and use popular software packaged as Helm Charts to run in Kubernetes
  • Share your own applications as Helm Charts
  • Create reproducible builds of your Kubernetes applications
  • Intelligently manage your Kubernetes manifest files
  • Manage releases of Helm packages

基本概念 #

  • Chart:一个 Helm 包,其中包含了运行一个应用所需要的镜像、依赖和资源定义等,还可能包含 Kubernetes 集群中的服务定义,
    • Chart 是用来封装 Kubernetes 原生应用程序的一系列 YAML 文件集合
    • 类似
      • Homebrew 中的 formula
      • apt 的 dpkg
      • yum/dnf 的 rpm
  • Repository:用于发布和存储 Chart 的存储库。
  • Release:在 Kubernetes 集群上运行的 Chart 的一个实例。在同一个集群上,一个 Chart 可以安装很多次。每次安装都会创建一个新的 release。例如一个 MySQL Chart,如果想在服务器上运行两个数据库,就可以把这个 Chart 安装两次。每次安装都会生成自己的 Release,会有自己的 Release 名称。
  • Tiller 是 Helm2 的服务端,通常运行在您的 kubernetes 集群中。Tiller 用于接收 Helm 的请求,并根据 Chart 生成 Kubernetes 的部署文件,然后提交给 Kubernetes 创建应用。
    • HElm3 中删除了 Tiller,只有客户端使用,调用 ~/.kube/config 来访问 api server 进行创建

命令 #

  completion  generate autocompletions script for the specified shell
  create      create a new chart with the given name
  dependency  manage a chart's dependencies
  env         helm client environment information
  get         download extended information of a named release
  help        Help about any command
  history     fetch release history
  install     install a chart
  lint        examine a chart for possible issues
  list        list releases
  package     package a chart directory into a chart archive
  plugin      install, list, or uninstall Helm plugins
  pull        download a chart from a repository and (optionally) unpack it in local directory
  repo        add, list, remove, update, and index chart repositories
  rollback    roll back a release to a previous revision
  search      search for a keyword in charts
  show        show information of a chart
  status      display the status of the named release
  template    locally render templates
  test        run tests for a release
  uninstall   uninstall a release
  upgrade     upgrade a release
  verify      verify that a chart at the given path has been signed and is valid
  version     print the client version information

开源镜像 #

BurdenBear/kube-charts-mirror

Github stars #

# 删除默认的源
helm repo remove stable
helm repo remove incubator

# 增加新的国内镜像源
helm repo add stable http://mirror.azure.cn/kubernetes/charts/

helm repo add incubator http://mirror.azure.cn/kubernetes/charts-incubator/

helm repo list

helm search repo mysql

TODO #

# Initialize a Helm Chart Repository
$ helm repo add stable https://kubernetes-charts.storage.googleapis.com/

# list the charts you can install
$ helm search repo stable

# Install an Example Chart
$ helm repo update
$ helm install stable/mysql --generate-name
NAME: mysql-1596179301
LAST DEPLOYED: Fri Jul 31 15:08:27 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
MySQL can be accessed via port 3306 on the following DNS name from within your cluster:
mysql-1596179301.default.svc.cluster.local

To get your root password run:

    MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace default mysql-1596179301 -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo)

To connect to your database:

1. Run an Ubuntu pod that you can use as a client:

    kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il

2. Install the mysql client:

    $ apt-get update && apt-get install mysql-client -y

3. Connect using the mysql cli, then provide your password:
    $ mysql -h mysql-1596179301 -p

To connect to your database directly from outside the K8s cluster:
    MYSQL_HOST=127.0.0.1
    MYSQL_PORT=3306

    # Execute the following command to route the connection:
    kubectl port-forward svc/mysql-1596179301 3306

    mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD}

本文访问量

本站总访问量

本站总访客数 人次