BlueXIII's Blog

热爱技术,持续学习

0%

常用中间件官方Helm安装

MySQL

https://artifacthub.io/packages/helm/bitnami/mysql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 添加仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# 拉取chart(可选)
helm pull bitnami/mysql --version 9.9.1

# 离线安装
dockemon chart bitnami mysql 9.9.1
helm install mysql ./mysql --namespace mysql --create-namespace
helm status mysql -n mysql

# DNS
mysql.mysql.svc.cluster.local:3306
# 查看root用户名
MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace mysql mysql -o jsonpath="{.data.mysql-root-password}" | base64 -d)
echo $MYSQL_ROOT_PASSWORD # rVrmiKcXOo
# 运行客户端
kubectl run mysql-client --rm --tty -i --restart='Never' --image docker.io/bitnami/mysql:8.0.33-debian-11-r7 --namespace mysql --env MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD --command -- bash
mysql -h mysql.mysql.svc.cluster.local -uroot -p"$MYSQL_ROOT_PASSWORD"
# 本机port-forward
kubectl port-forward --namespace mysql svc/mysql 3306:3306

Redis

https://artifacthub.io/packages/helm/bitnami/redis

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 添加仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# 查看所有版本号
helm search repo bitnami/redis --versions --devel
# 拉取chart(可选)
helm pull bitnami/redis --version 17.10.3

# 离线安装
dockemon chart bitnami redis 17.10.3
helm install redis ./redis --namespace redis --create-namespace
helm status redis -n redis

# DNS
redis-master.redis.svc.cluster.local for read/write operations (port 6379)
redis-replicas.redis.svc.cluster.local for read-only operations (port 6379)
# 查看密码
export REDIS_PASSWORD=$(kubectl get secret --namespace redis redis -o jsonpath="{.data.redis-password}" | base64 -d)
echo $REDIS_PASSWORD # 4BEkvq5vdW
# 运行Client
kubectl run --namespace redis redis-client --restart='Never' --env REDIS_PASSWORD=$REDIS_PASSWORD --image docker.io/bitnami/redis:7.0.11-debian-11-r7 --command -- sleep infinity
kubectl exec --tty -i redis-client --namespace redis -- bash
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-master
# 本机port-forward
kubectl port-forward --namespace redis svc/redis-master 6379:6379
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h 127.0.0.1 -p 6379

Zookeeper

https://artifacthub.io/packages/helm/bitnami/zookeeper

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 添加仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# 查看所有版本号
helm search repo bitnami/zookeeper --versions --devel
# 拉取chart(可选)
helm pull bitnami/zookeeper --version 11.3.2

# 离线安装
dockemon chart bitnami zookeeper 11.3.2
helm install zookeeper ./zookeeper --namespace zookeeper --create-namespace
helm status zookeeper -n zookeeper

# DNS
zookeeper.zookeeper.svc.cluster.local
# 客户端
export POD_NAME=$(kubectl get pods --namespace zookeeper -l "app.kubernetes.io/name=zookeeper,app.kubernetes.io/instance=zookeeper,app.kubernetes.io/component=zookeeper" -o jsonpath="{.items[0].metadata.name}")
echo $POD_NAME
kubectl exec -it --namespace zookeeper $POD_NAME -- zkCli.sh
# 本机port-forward
kubectl port-forward --namespace zookeeper svc/zookeeper 2181:2181
zkCli.sh 127.0.0.1:2181

Minio

https://helm.min.io/

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 添加仓库
helm repo add minio https://helm.min.io/
helm update
# 查看所有版本号
helm search repo minio/minio --versions --devel
# 拉取chart(可选)
helm pull minio/minio --version 8.0.10

# 离线安装
dockemon chart minio minio 8.0.10
helm install minio ./minio --namespace minio --create-namespace
helm status minio -n minio

# 本机portforward
export POD_NAME=$(kubectl get pods --namespace minio -l "release=minio" -o jsonpath="{.items[0].metadata.name}")
echo $POD_NAME
kubectl port-forward $POD_NAME 9000 --namespace minio
# 查看access_key/secret_key
ACCESS_KEY=$(kubectl get secret minio --namespace minio -o jsonpath="{.data.accesskey}" | base64 --decode)
SECRET_KEY=$(kubectl get secret minio --namespace minio -o jsonpath="{.data.secretkey}" | base64 --decode)
echo $ACCESS_KEY $SECRET_KEY

Nginx

https://artifacthub.io/packages/helm/bitnami/nginx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# 添加仓库
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
# 查看所有版本号
helm search repo bitnami/nginx --versions --devel
# 拉取chart(可选)
helm pull bitnami/nginx --version 14.2.1

# 离线安装
dockemon chart bitnami nginx 14.2.1
helm install nginx ./nginx --namespace nginx --create-namespace
helm status nginx -n nginx


export SERVICE_PORT=$(kubectl get --namespace nginx -o jsonpath="{.spec.ports[0].port}" services nginx)
export SERVICE_IP=$(kubectl get svc --namespace nginx nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo "http://${SERVICE_IP}:${SERVICE_PORT}"

Neo4j

https://github.com/neo4j-contrib/neo4j-helm
https://artifacthub.io/packages/helm/neo4j-helm-charts/neo4j

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# 编辑镜像清单
dockemon edit
neo4j:4.4.10-enterprise
gcr.io/neo4j-helm/restore:4.1.0-1

# 推送离线镜像
dockemon image

# 手工下载Chart
https://github.com/neo4j-contrib/neo4j-helm/releases
tar -zxvf neo4j-4.4.10.1.tgz & cd neo4j
# 注意修改values.yaml,pvc.size改小

# Chart安装
helm install neo4j ./neo4j --set core.standalone=true --set acceptLicenseAgreement=yes --set neo4jPassword=abcd1234 --namespace neo4j --create-namespace