helm启动单节点mysql

前言

1)本文使用helm启动单节点mysql。
2)生产高可用集群: 《helm启动mysql-ha》
3)其他部署方式:《docker-compose启动mysql》《helm启动单节点mysql》
4))web管理工具推荐 :《k8s启动phpmyadmin》

1. 准备

  • chart包
    从 https://github.com/helm/charts 已下载 charts-master, 其中stable目录里包含mysql目录,该目录即为单机版mysql的chart包

  • 安装文档
    进入上边github地址,找到msyql目录,下边有安装文档和所有可以换变量。

2. 修改变量

mysql/values.yaml 文件包含需要修改的变量

  • 修改root密码
    如果这里不设置,也可以启动Release的时候用命令覆盖。
mysqlRootPassword: YunWeiDao888
  • 修改为 service
    修改service 代理方式为nodeport
service:
  annotations: {}
  ## Specify a service type
  ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types
  type: NodePort
  #type: ClusterIP
  port: 13306
  nodePort: 30102
  # nodePort: 32000
  # loadBalancerIP:
  • 其他根据需要修改

3. 启动Release

# cd charts-master/stable/mysql
# helm install mysql -n mysql --set mysqlRootPassword=YunWeiDao888 ./

说明:如果前边在values.yaml文件中修改了,上边命令可以不加 --set mysqlRootPassword

FAQ

有些镜像版本默认root只能本地用户登录,且不使用密码。

因此需要进入容器不使用密码登录

# kubectl exec -it -n mysql mysql-7f4776db6f-hft2r bash
# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5677
Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

创建远程登录账号

mysql> grant all on *.* to root@'%' identified by ' YunWeiDao888';
mysql> flush privilege;

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

玄德公笔记

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值