CentOS Stream 9
Sponsored Link

Kubernetes : Helm インストール2023/10/20

 

Helm をインストールすると、Kubernetes アプリケーションのイントール等々の管理が容易になります。

当例では以下のように 4 台のノードを使用して Kubernetes クラスターを構成しています。

+----------------------+   +----------------------+
|   [ mgr.srv.world ]  |   |   [ dlp.srv.world ]  |
|     Manager Node     |   |     Control Plane    |
+-----------+----------+   +-----------+----------+
        eth0|10.0.0.25             eth0|10.0.0.30
            |                          |
------------+--------------------------+-----------
            |                          |
        eth0|10.0.0.51             eth0|10.0.0.52
+-----------+----------+   +-----------+----------+
| [ node01.srv.world ] |   | [ node02.srv.world ] |
|     Worker Node#1    |   |     Worker Node#2    |
+----------------------+   +----------------------+

[1] Helm をインストールします。
[root@mgr ~]#
curl -O https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
[root@mgr ~]#
bash ./get-helm-3

Downloading https://get.helm.sh/helm-v3.13.1-linux-amd64.tar.gz
Verifying checksum... Done.
Preparing to install helm into /usr/local/bin
helm installed into /usr/local/bin/helm
[root@mgr ~]#
helm version

version.BuildInfo{Version:"v3.13.1", GitCommit:"3547a4b5bf5edb5478ce352e18858d8a552a4110", GitTreeState:"clean", GoVersion:"go1.20.8"}
[2] Helm の基本操作です。
# Helm Hub からキーワードが含まれるチャートを検索

[root@mgr ~]#
helm search hub wordpress

URL                                                     CHART VERSION   APP VERSION             DESCRIPTION                     
https://artifacthub.io/packages/helm/wordpress-...      1.0.2           1.0.0                   A Helm chart for deploying Wordpress+Mariadb st...
https://artifacthub.io/packages/helm/kube-wordp...      0.1.0           1.1                     this is my wordpress package    
https://artifacthub.io/packages/helm/shubham-wo...      0.1.0           1.16.0                  A Helm chart for Kubernetes     
.....
.....

# リポジトリを追加
# 以下はオフィシャル Helm Stable リポジトリ

[root@mgr ~]#
helm repo add stable https://charts.helm.sh/stable

"stable" has been added to your repositories
[root@mgr ~]#
helm repo add bitnami https://charts.bitnami.com/bitnami

"bitnami" has been added to your repositories
# リポジトリ一覧

[root@mgr ~]#
helm repo list

NAME    URL
stable  https://charts.helm.sh/stable
bitnami https://charts.bitnami.com/bitnami

# リポジトリからキーワードが含まれるチャートを検索

[root@mgr ~]#
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/apm-server                       2.1.7           7.0.0                   DEPRECATED The server receives data from the El...
stable/ark                              4.2.2           0.10.2                  DEPRECATED A Helm chart for ark                 
.....
.....

# チャートの情報を表示
# helm show [all|chart|readme|values] [チャート名]

[root@mgr ~]#
helm show chart bitnami/wordpress

annotations:
  category: CMS
  images: |
    - name: apache-exporter
      image: docker.io/bitnami/apache-exporter:1.0.2-debian-11-r10
    - name: os-shell
      image: docker.io/bitnami/os-shell:11-debian-11-r90
    - name: wordpress
      image: docker.io/bitnami/wordpress:6.3.2-debian-11-r0
  licenses: Apache-2.0
apiVersion: v2
appVersion: 6.3.2
dependencies:
- condition: memcached.enabled
  name: memcached
  repository: oci://registry-1.docker.io/bitnamicharts
  version: 6.x.x
- condition: mariadb.enabled
  name: mariadb
  repository: oci://registry-1.docker.io/bitnamicharts
  version: 14.x.x
- name: common
  repository: oci://registry-1.docker.io/bitnamicharts
  tags:
  - bitnami-common
  version: 2.x.x
description: WordPress is the world's most popular blogging and content management
  platform. Powerful yet simple, everyone from students to global corporations use
  it to build beautiful, functional websites.
home: https://bitnami.com
icon: https://bitnami.com/assets/stacks/wordpress/img/wordpress-stack-220x234.png
keywords:
- application
- blog
- cms
- http
- php
- web
- wordpress
maintainers:
- name: VMware, Inc.
  url: https://github.com/bitnami/charts
name: wordpress
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/wordpress
version: 18.0.7

# チャートからアプリケーションをデプロイ
# helm install [任意の名称] [チャート名]

[root@mgr ~]#
helm install wordpress bitnami/wordpress

NAME: wordpress
LAST DEPLOYED: Fri Oct 20 15:36:37 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: wordpress
CHART VERSION: 18.0.7
APP VERSION: 6.3.2

** Please be patient while the chart is being deployed **

Your WordPress site can be accessed through the following DNS name from within your cluster:

    wordpress.default.svc.cluster.local (port 80)

To access your WordPress site from outside the cluster follow the steps below:

1. Get the WordPress URL by running these commands:

  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        Watch the status with: 'kubectl get svc --namespace default -w wordpress'

   export SERVICE_IP=$(kubectl get svc --namespace default wordpress --template "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}")
   echo "WordPress URL: http://$SERVICE_IP/"
   echo "WordPress Admin URL: http://$SERVICE_IP/admin"

2. Open a browser and access WordPress using the obtained URL.

3. Login with the following credentials below to see your blog:

  echo Username: user
  echo Password: $(kubectl get secret --namespace default wordpress -o jsonpath="{.data.wordpress-password}" | base64 -d)

# デプロイ済みアプリケーションの一覧

[root@mgr ~]#
helm list

NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                  APP VERSION
wordpress       default         1               2023-10-20 15:36:37.141021313 +0900 JST deployed        wordpress-18.0.7       6.3.2

# デプロイ済みアプリケーションのステータスを表示

[root@mgr ~]#
helm status wordpress

NAME: wordpress
LAST DEPLOYED: Fri Oct 20 15:36:37 2023
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: wordpress
CHART VERSION: 18.0.7
APP VERSION: 6.3.2
.....
.....

# デプロイ済みアプリケーションをアンインストール

[root@mgr ~]#
helm uninstall wordpress

release "registry" uninstalled
関連コンテンツ