microk8s helm2 Error: no availa
2020-04-13 本文已影响0人
小黑佬
错误
Error: no available release name found
版本
$ microk8s.helm version
Client: &version.Version{SemVer:"v2.16.0", GitCommit:"e13bc94621d4ef666270cfbe734aaabf342a49bb", GitTreeState:"clean"}
Server: &version.Version{SemVer:"v2.16.0", GitCommit:"e13bc94621d4ef666270cfbe734aaabf342a49bb", GitTreeState:"clean"}
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:50:46Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
解决办法
kubectl create serviceaccount --namespace kube-system tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
kubectl patch deploy --namespace kube-system tiller-deploy -p '{"spec":{"template":{"spec":{"serviceAccount":"tiller"}}}}'
#
kubectl delete deployment tiller-deploy --namespace kube-system # 注意: 这个语句我没有用到
helm init --upgrade --service-account default
最后我可以使用helm 了
$ microk8s.helm install stable/mariadb
NAME: exiled-liger
LAST DEPLOYED: Mon Apr 13 11:08:36 2020
NAMESPACE: default
STATUS: DEPLOYED
RESOURCES:
==> v1/ConfigMap
NAME AGE
exiled-liger-mariadb-master 1s
exiled-liger-mariadb-slave 1s
exiled-liger-mariadb-tests 1s
==> v1/Secret
NAME AGE
exiled-liger-mariadb 1s
==> v1/Service
NAME AGE
exiled-liger-mariadb 1s
exiled-liger-mariadb-slave 1s
==> v1/StatefulSet
NAME AGE
exiled-liger-mariadb-master 1s
exiled-liger-mariadb-slave 1s
NOTES:
This Helm chart is deprecated
Given the `stable` deprecation timeline (https://github.com/helm/charts#deprecation-timeline), the Bitnami maintained Helm chart is now located at bitnami/charts (https://github.com/bitnami/charts/).
The Bitnami repository is already included in the Hubs and we will continue providing the same cadence of updates, support, etc that we've been keeping here these years. Installation instructions are very similar, just adding the _bitnami_ repo and using it during the installation (`bitnami/<chart>` instead of `stable/<chart>`)
```bash
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install my-release bitnami/<chart> # Helm 3
$ helm install --name my-release bitnami/<chart> # Helm 2
To update an exisiting stable deployment with a chart hosted in the bitnami repository you can execute
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm upgrade my-release bitnami/<chart>
Issues and PRs related to the chart itself will be redirected to bitnami/charts
GitHub repository. In the same way, we'll be happy to answer questions related to this migration process in this issue (https://github.com/helm/charts/issues/20969) created as a common place for discussion.
Please be patient while the chart is being deployed
Tip:
Watch the deployment status using the command: kubectl get pods -w --namespace default -l release=exiled-liger
Services:
echo Master: exiled-liger-mariadb.default.svc.cluster.local:3306
echo Slave: exiled-liger-mariadb-slave.default.svc.cluster.local:3306
Administrator credentials:
Username: root
Password : $(kubectl get secret --namespace default exiled-liger-mariadb -o jsonpath="{.data.mariadb-root-password}" | base64 --decode)
To connect to your database:
1. Run a pod that you can use as a client:
kubectl run exiled-liger-mariadb-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mariadb:10.3.22-debian-10-r27 --namespace default --command -- bash
2. To connect to master service (read/write):
mysql -h exiled-liger-mariadb.default.svc.cluster.local -uroot -p my_database
3. To connect to slave service (read-only):
mysql -h exiled-liger-mariadb-slave.default.svc.cluster.local -uroot -p my_database
To upgrade this helm chart:
1. Obtain the password as described on the 'Administrator credentials' section and set the 'rootUser.password' parameter as shown below:
ROOT_PASSWORD=$(kubectl get secret --namespace default exiled-liger-mariadb -o jsonpath="{.data.mariadb-root-password}" | base64 --decode)
helm upgrade exiled-liger stable/mariadb --set rootUser.password=$ROOT_PASSWORD
查看services 服务 和 deployments
$ kubectl get service
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
exiled-liger-mariadb ClusterIP 10.152.183.20 <none> 3306/TCP 19m
exiled-liger-mariadb-slave ClusterIP 10.152.183.240 <none> 3306/TCP 19m
kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 2d
my-release-nginx-ingress LoadBalancer 10.152.183.105 <pending> 80:31738/TCP,443:30270/TCP 42h
$ kubectl describe service exiled-liger-mariadb
Name: exiled-liger-mariadb
Namespace: default
Labels: app=mariadb
chart=mariadb-7.3.14
component=master
heritage=Tiller
release=exiled-liger
Annotations: <none>
Selector: app=mariadb,component=master,release=exiled-liger
Type: ClusterIP
IP: 10.152.183.20
Port: mysql 3306/TCP
TargetPort: mysql/TCP
Endpoints: 10.1.36.48:3306
Session Affinity: None
Events: <none>
$kubectl describe service exiled-liger-mariadb-slave
Name: exiled-liger-mariadb-slave
Namespace: default
Labels: app=mariadb
chart=mariadb-7.3.14
component=slave
heritage=Tiller
release=exiled-liger
Annotations: <none>
Selector: app=mariadb,component=slave,release=exiled-liger
Type: ClusterIP
IP: 10.152.183.240
Port: mysql 3306/TCP
TargetPort: mysql/TCP
Endpoints: 10.1.36.49:3306
Session Affinity: None
Events: <none>
# 查看deployments 没有和数据库相关的···
$ kubectl get deployments
NAME READY UP-TO-DATE AVAILABLE AGE
kubernetes-bootcamp 1/1 1 1 44h
my-release-nginx-ingress 1/1 1 1 42h
nginx 1/1 1 1 43h