これまでの失敗の一因:
(1)microk8s config >.kube/configの未実施。
(2)クリーンでない環境へインストールしようとした。(例えば、80/tcpが既に使われていた環境)
$ microk8s config >.kube/config を実行しておかないと、次のようなエラーとなる。
The connection to the server localhost:8080 was refused - did you specify the right host or port?
#helmをmake
git clone https://github.com/helm/helm.git
cd helm
#ここでmakeすると go が欠落していてエラー snapでgoをインストール
sudo snap install go --classic
make
sudo make install
kubectl create namespace helm-test
namespace/helm-test created
mars@mars-VirtualBox:~$ helm install test bitnami/wordpress --namespace helm-test
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/mars/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/mars/.kube/config
NAME: test
LAST DEPLOYED: Tue Jun 22 19:46:16 2021
NAMESPACE: helm-test
STATUS: deployed
REVISION: 1
NOTES:
** Please be patient while the chart is being deployed **
Your WordPress site can be accessed through the following DNS name from within your cluster:
test-wordpress.helm-test.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 helm-test -w test-wordpress'
export SERVICE_IP=$(kubectl get svc --namespace helm-test test-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 helm-test test-wordpress -o jsonpath="{.data.wordpress-password}" | base64 --decode)
次のように、wordpressとmariadbが起動している。
helm list -n helm-test
WARNING: Kubernetes configuration file is group-readable. This is insecure. Location: /home/mars/.kube/config
WARNING: Kubernetes configuration file is world-readable. This is insecure. Location: /home/mars/.kube/config
NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
test helm-test 1 2021-06-22 19:46:16.598835081 +0900 JST deployed wordpress-11.0.16 5.7.2
$ kubectl get po -n helm-test
NAME READY STATUS RESTARTS AGE
test-wordpress-8d8bb84b6-m5b5j 0/1 Running 0 87s
test-mariadb-0 1/1 Running 0 87s
Adminでログインしたwordpressの画面