helm笔记
helm笔记
helm 部署zookeeper集群
# 添加bitnami和官方helm仓库:
helm repo add bitnami https://charts.bitnami.com/bitnami
# 查看仓库
helm repo list
# 部署zookeeper集群
helm install zookeeper bitnami/zookeeper \
--set replicaCount=3 \
--set auth.enabled=false \
--set allowAnonymousLogin=true
# 查看
helm list
# 部署kafka集群
helm install kafka bitnami/kafka \
--set zookeeper.enabled=false \
--set replicaCount=3 \
--set externalZookeeper.servers=ZOOKEEPER-SERVICE-NAME # ZOOKEEPER-SERVICE-NAME 替换为上一步结束时获得的Apache ZOOKEEPER服务名称
# 创建存放压缩包目录
mkdir /bsm/zookeeper-kafka && cd /bsm/zookeeper-kafka
# 拉取压缩包
helm pull bitnami/zookeeper
helm pull bitnami/kafka
# 解压
tar -zvxf kafka-22.1.2.tgz
tar -zvxf zookeeper-11.4.1.tgz
# 安装zookeeper
cd /bsm/zookeeper-kafka/zookeeper
helm install zookeeper --set replicaCount=3 --set auth.enabled=false --set allowAnonymousLogin=true ./
# ./ 表示zookeeper的value.yaml文件所在路径
# 查看pod状态:
[root@k8s-master1 rabbitmq]# kubectl get pods
NAME READY STATUS RESTARTS AGE
zookeeper-0 1/1 Running 0 85s
zookeeper-1 1/1 Running 0 85s
zookeeper-2 1/1 Running 0 84s
# 安装zookeeper
cd /bsm/zookeeper-kafka/kafka
helm install kafka --set zookeeper.enabled=false --set replicaCount=3 --set externalZookeeper.servers=ZOOKEEPER-SERVICE-NAME ./
# ZOOKEEPER-SERVICE-NAME 替换为上一步结束时获得的Apache ZOOKEEPER服务名称
# ./ 表示kafka的value.yaml文件所在路径
报错:
Error: INSTALLATION FAILED: execution error at (kafka/templates/NOTES.txt:314:4):
VALUES VALIDATION:
kafka: Kraft mode
You cannot use Kraft mode and Zookeeper at the same time. They are mutually exclusive. Disable zookeeper in ‘.Values.zookeeper.enabled’ and delete values from ‘.Values.externalZookeeper.servers’ if you want to use Kraft mode
原因:
新版kafka新增了一个kraft模式,他与zookeeper是冲突的,不能同时使用,所以如果使用指定的zookeeper,kraft模式要关闭。
解决办法:
修改kafka的配置文件“value.yaml”,将 kraft.enable 的值改为false
kubectl logs -f kafka-0 | grep socket
# 进入kafka的pod创建一个topic
[root@k8s-master1 kafka]# kubectl exec -it kafka-0 bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
I have no name!@kafka-0:/$ kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic testtopic
heCreated topic testtopic.
# 启动一个消费者
[root@k8s-master1 ~]# kubectl exec -it kafka-0 bash
I have no name!@kafka-0:/$ kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic
# 新开一个窗口,进入kafka的pod,启动一个生产者,输入消息;在消费者端可以收到消息
[root@k8s-master1 ~]# kubectl exec -it kafka-0 bash
kubectl exec [POD] [COMMAND] is DEPRECATED and will be removed in a future version. Use kubectl exec [POD] -- [COMMAND] instead.
I have no name!@kafka-0:/$ kafka-console-producer.sh --bootstrap-server localhost:9092 --topic testtopic
helm uninstall kafka -n [namespace]
helm uninstall zookeeper -n [namespace]


参考文章:
bitnami官网:https://docs.bitnami.com/tutorials/deploy-scalable-kafka-zookeeper-cluster-kubernetes
csdn文章:https://blog.csdn.net/heian_99/article/details/114840056
提示:
由于这个ApacheZookeeper集群不会公开,所以在部署时禁用了身份验证。对于生产环境,请考虑使用生产配置。
生产环境参考:https://github.com/bitnami/charts/tree/main/bitnami/zookeeper#production-configuration
原文链接:https://blog.csdn.net/weixin_64124795/article/details/130772120
k8s helm安装 tidb分布式数据库
https://zhuanlan.zhihu.com/p/474152037
Helm 部署 mysql
用 Helm 在 k8s 上快速搭建 MySQL 主从集群
https://backend.devrank.cn/traffic-information/7210434169070061627
https://blog.51cto.com/u_13760351/2898442
Helm(舵柄/舵轮)

下载地址:https://github.com/kubernetes/helm/releases
wget https://get.helm.sh/helm-v3.4.1-linux-amd64.tar.gz
tar xvf helm-v3.4.1-linux-amd64.tar.gz
mv linux-amd64/helm /bin/helm
helm version
# 添加bitnami和官方helm仓库:
helm repo add bitnami https://charts.bitnami.com/bitnami
# 查看仓库
helm repo list
# 部署zookeeper集群
helm install zookeeper bitnami/zookeeper \
--set replicaCount=3 \
--set auth.enabled=false \
--set allowAnonymousLogin=true
# 查看
helm list
[root@k8s ~]# helm repo list
NAME URL
bitnami https://charts.bitnami.com/bitnami
mysql-operator https://mysql.github.io/mysql-operator/
# 微软源
helm repo add stable http://mirror.azure.cn/kubernetes/charts/
helm repo update
# 补充: 可用helm repo remove stable删除仓库
helm search repo stable
helm search repo nginx
helm search repo tomcat
helm pull stable/mysql # 默认下载最新版
helm pull stable/mysql --version 1.6.8 # 指定下载某一个版本
tar xf mysql-1.6.8.tgz
ls mysql
helm install stable/mysql --generate-name
helm install mysql-1.6.8.tgz --generate-name
helm install stable/mysql --generate-name
helm ls
kubectl get all -l release=mysql-1605192239
helm show chart stable/mysql
helm show all stable/mysql
helm uninstall mysql-1623196571
helm show values stable/mysql
vim mysql-config.yml
mysqlUser: daniel
mysqlPassword: "123" # 密码纯数字需要引起来,否则报类型错误
mysqlDatabase: helm
persistence:
enabled: false # 前面就是因为这里为True,启不来pod。现在没有存储卷,改为false
helm install mysql -f mysql-config.yml stable/mysql









参考
https://blog.csdn.net/weixin_64124795/article/details/130772120
https://blog.51cto.com/u_13760351/2898442

浙公网安备 33010602011771号