Ubuntu 22.04
Sponsored Link

Kubernetes : Helm インストール
2022/11/03
 
Helm をインストールすると、Kubernetes アプリケーションのイントール等々の管理が容易になります。
当例では以下のように 3 台のノードを使用して Kubernetes クラスターを構成しています。
-----------+---------------------------+--------------------------+------------
           |                           |                          |
       eth0|10.0.0.25              eth0|10.0.0.71             eth0|10.0.0.72
+----------+-----------+   +-----------+-----------+   +-----------+-----------+
|  [ ctrl.srv.world ]  |   |  [snode01.srv.world]  |   |  [snode02.srv.world]  |
|     Control Plane    |   |      Worker Node      |   |      Worker Node      |
+----------------------+   +-----------------------+   +-----------------------+

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

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

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

root@ctrl:~#
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/shubham-wo...      0.1.0           1.16.0                  A Helm chart for Kubernetes     
https://artifacthub.io/packages/helm/bitnami/wo...      15.2.10         6.1.0                   WordPress is the world's most popular blogging ...
.....
.....

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

root@ctrl:~#
helm repo add stable https://charts.helm.sh/stable

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

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

root@ctrl:~#
helm repo list

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

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

root@ctrl:~#
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...
.....
.....

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

root@ctrl:~#
helm show chart bitnami/wordpress

annotations:
  category: CMS
apiVersion: v2
appVersion: 6.1.0
dependencies:
- condition: memcached.enabled
  name: memcached
  repository: https://charts.bitnami.com/bitnami
  version: 6.x.x
- condition: mariadb.enabled
  name: mariadb
  repository: https://charts.bitnami.com/bitnami
  version: 11.x.x
- name: common
  repository: https://charts.bitnami.com/bitnami
  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://github.com/bitnami/charts/tree/main/bitnami/wordpress
icon: https://bitnami.com/assets/stacks/wordpress/img/wordpress-stack-220x234.png
keywords:
- application
- blog
- cms
- http
- php
- web
- wordpress
maintainers:
- name: Bitnami
  url: https://github.com/bitnami/charts
name: wordpress
sources:
- https://github.com/bitnami/containers/tree/main/bitnami/wordpress
- https://wordpress.org/
version: 15.2.10

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

root@ctrl:~#
helm install wordpress bitnami/wordpress

NAME: wordpress
LAST DEPLOYED: Thu Nov  3 05:27:16 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: wordpress
CHART VERSION: 15.2.10
APP VERSION: 6.1.0

** 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 --include "{{ 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@ctrl:~#
helm list

NAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                  APP VERSION
wordpress       default         1               2022-11-03 05:27:16.505435499 +0000 UTC deployed        wordpress-15.2.10      6.1.0

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

root@ctrl:~#
helm status wordpress

NAME: wordpress
LAST DEPLOYED: Thu Nov  3 05:27:16 2022
NAMESPACE: default
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
CHART NAME: wordpress
CHART VERSION: 15.2.10
APP VERSION: 6.1.0
.....
.....

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

root@ctrl:~#
helm uninstall wordpress

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