编程开源技术交流,分享技术与知识

网站首页 > 开源技术 正文

kubernetes1.24从构建到躺平「八」

wxchong 2024-08-07 01:43:44 开源技术 14 ℃ 0 评论

Helm部署及基本使用

OS: UbuntuServer 22.04 LTS

一: 下载Helm

root@srv1:~# curl -O https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3

root@srv1:~# bash ./get-helm-3
Downloading https://get.helm.sh/helm-v3.9.0-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm

root@srv1:~# helm version
version.BuildInfo{Version:"v3.9.0", GitCommit:"7ceeda6c585217a19a1131663d8cd1f7d641b2a7", GitTreeState:"clean", GoVersion:"go1.17.5"}


二: 基本使用

1)使用Helm查找

root@srv1:~# helm search hub wordpress
URL                                                     CHART VERSION   APP VERSION             DESCRIPTION
https://artifacthub.io/packages/helm/kube-wordp...      0.1.0           1.1                     this is my wordpress package
https://artifacthub.io/packages/helm/bitnami/wo...      15.0.4          6.0.0                   WordPress is the world's most popular blogging ...
https://artifacthub.io/packages/helm/bitnami-ak...      15.0.4          6.0.0                   WordPress is the world's most popular blogging ...
https://artifacthub.io/packages/helm/sikalabs/w...      0.2.0                                   Simple Wordpress

2) 添加国内repository

root@srv1:~# helm repo add stable http://mirror.azure.cn/kubernetes/charts/
"stable" has been added to your repositories

root@srv1:~# helm repo list
NAME    URL                                      
stable  http://mirror.azure.cn/kubernetes/charts/

root@srv1:~# helm show chart stable/docker-registry
apiVersion: v1
appVersion: 2.7.1
deprecated: true
description: DEPRECATED A Helm chart for Docker Registry
home: https://hub.docker.com/_/registry/
icon: https://hub.docker.com/public/images/logos/mini-logo.svg
name: docker-registry
sources:
- https://github.com/docker/distribution-library-image
version: 1.9.6

root@srv1:~# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
Update Complete. ?Happy Helming!?

# 删除repo:
root@srv1:~# helm repo remove stable

3) 按关键字搜索repo

root@srv1:~# helm search repo stable
NAME                                    CHART VERSION   APP VERSION             DESCRIPTION                    
stable/acs-engine-autoscaler            2.2.2           2.1.1                   DEPRECATED Scales worker nodes within agent pools
stable/aerospike                        0.3.5           v4.5.0.5                DEPRECATED A Helm chart for Aerospike in Kubern... 
stable/airflow                          7.13.3          1.10.12                 DEPRECATED - please use: https://github.com/air...
stable/ambassador                       5.3.2           0.86.1                  DEPRECATED A Helm chart for Datawire Ambassador
stable/anchore-engine                   1.7.0           0.7.3                   Anchore container analysis and policy evaluatio..
......
......
......
......
......
......
stable/weave-scope                      1.1.12          1.12.0                  DEPRECATED - A Helm chart for the Weave Scope c...
stable/wordpress                        9.0.3           5.3.2                   DEPRECATED Web publishing platform for building...
stable/xray                             0.4.3           2.3.0                   DEPRECATED Universal component scan for securit...
stable/zeppelin                         1.1.3           0.7.2                   DEPRECATED - Web-based notebook that enables da...
stable/zetcd                            0.1.11          0.0.3                   DEPRECATED CoreOS zetcd Helm chart for Kubernetes

4) 显示chart详细信息

root@srv1:~# helm show chart stable/docker-registry
apiVersion: v1
appVersion: 2.7.1
deprecated: true
description: DEPRECATED A Helm chart for Docker Registry
home: https://hub.docker.com/_/registry/
icon: https://hub.docker.com/public/images/logos/mini-logo.svg
name: docker-registry
sources:
- https://github.com/docker/distribution-library-image
version: 1.9.6

5) 部署指定的应用

root@srv1:~# helm install registry stable/docker-registry
NAME: registry
LAST DEPLOYED: Fri Jun 24 17:20:42 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app=docker-registry,release=registry" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl -n default port-forward $POD_NAME 8080:5000

6) 确认

root@srv1:~# helm list
NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART
registry        default         1               2022-06-24 17:20:42.518920481 +0800 CST deployed        docker-registry-1.9.6   
APP VERSION
2.7.1

root@srv1:~# helm status registry
NAME: registry
LAST DEPLOYED: Fri Jun 24 17:20:42 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
1. Get the application URL by running these commands:
  export POD_NAME=$(kubectl get pods --namespace default -l "app=docker-registry,release=registry" -o jsonpath="{.items[0].metadata.name}")
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl -n default port-forward $POD_NAME 8080:5000

7) 卸载应用

root@srv1:~# helm uninstall registry
release "registry" uninstalled

root@srv1:~# helm list
NAME    NAMESPACE       REVISION        UPDATED STATUS  CHART   APP VERSION

Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表