当前位置:网站首页>Deploying MySQL in cloud native kubesphere
Deploying MySQL in cloud native kubesphere
2022-04-23 12:39:00 【Love pocket sky】
One 、 brief introduction
Use KubeShere Deployment application architecture diagram :
Pay attention to three points :
- Application deployment mode
- Application data mount ( data 、 The configuration file )
- Accessibility of applications
Two 、 Deploy MySql Analysis and preparation of
1、 Refer to our previous use docker Deployment launch mysql The script is as follows
docker run -p 3306:3306 --name mysql-01 \ -v /mydata/mysql/log:/var/log/mysql \ -v /mydata/mysql/data:/var/lib/mysql \ -v /mydata/mysql/conf:/etc/mysql/conf.d \ -e MYSQL_ROOT_PASSWORD=root \ --restart=always \ -d mysql:5.7
2、 Get ready mysql Configuration file for
[client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] init_connect='SET collation_connection = utf8mb4_unicode_ci' init_connect='SET NAMES utf8mb4' character-set-server=utf8mb4 collation-server=utf8mb4_unicode_ci skip-character-set-client-handshake skip-name-resolve
3、mysql Deployment Analysis
/var/lib/mysql: This path is in the container mysql The path where the data file is stored , We use pvc Make it persistent
/etc/mysql/conf.d: This is a directory , There is a my.cnf The configuration file , We use configMap Cover it with
MYSQL_ROOT_PASSWORD: This is an environment variable , Set default root Account password
3、 ... and 、 establish ConfigMap To configure mysql Of my.cnf file
1、 Enter the configuration center -> To configure -> establish
2、 Start configuration ConfigMap
![]()
ok, So that we mysql Corresponding ConfigMap And we're done
Four 、 Create to persist mysql Data file pvc Storage
1、 Enter storage management -> Storage volume , Click Create
2、 Start creating storage volumes
![]()
Above , Create success !
5、 ... and 、 Start creating stateful Services mysql
1、 Enter application load -> The workload -> Stateful replica set , Click Create
2、 Start to create mysql service
Click next .
Click Add container image above , Choose a mirror image : choice DockerHub Upper mysql:5.7 Mirror image .
Down : Select limits 1 nucleus cpu and 2000M Memory and port mapping .
Down :
Check environment variable :MYSQL_ROOT_PASSWORD
password :123456
.
Time zone host... Check .
Click on √ Hook And click next :
Select add storage volume , Because our storage volume has been created , That's it. mysql-pvc, Mount Directory :
/var/lib/mysql
choiceReading and writing
.
Above is our persistence mysql Of the data file , Now let's mount the configuration file :
Click mount Profile :
Click next :
Click Create :
You can click to view :
You can find that it has been created successfully
You can also view mysql Log and enter the terminal to view information
6、 ... and 、 Create a good... Through intranet access mysql
1、 First enter through the terminal mysql Internal , Let's see if our configuration file is effective
From above, we can find , It's in effect
2、 We can apply load -> service , Check out the... We just created mysql Automatically generated service service
From the above, we can find that we can't access the Internet , Can only be accessed between intranet containers , Because the type is ClusterIP
It can be found that the Intranet can be connected , If you want to access the Internet , We need to configure service, Of course, generally in the production environment , Intranet access is enough , Because here kubesphere The network between containers on the is connected .
7、 ... and 、 Create a good... Through Internet access mysql
1、 In the application load -> Create another one in the service mysql Service service
![]()
Create success , The port mapped to the outside is 30805
2、 Let's start to access... Through the tools of the Internet ,
版权声明
本文为[Love pocket sky]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231236523011.html
边栏推荐
- 航芯技术分享 | ACM32 MCU安全特性概述
- Zero trust in network information security
- PHP generates JSON to process Chinese
- 0基础可以考CPDA数据分析师证书吗
- 甲辰篇 創世紀《「內元宇宙」聯載》
- Please help me see what this is, mysql5 5. Thanks
- 消息队列概述
- 解锁OpenHarmony技术日!年度盛会,即将揭幕!
- Can I take the CPDA data analyst certificate for 0 foundation
- What are the forms of attack and tampering on the home page of the website
猜你喜欢
随机推荐
BUUCTF WEB [GXYCTF2019]禁止套娃
Stm32cubeprogrammer basic instructions
31岁才转行程序员,目前34了,我来说说我的经历和一些感受吧...
uni-app 原生APP-云打包集成极光推送(JG-JPUSH)详细教程
没有空闲服务器?导入 OVF 镜像快速体验 SmartX 超融合社区版
对话PostgreSQL作者Bruce:“转行”是为了更好地前行
Lesson 24 analysis of classical problems
QT redraw events and cuts
Lesson 25 static member variables of classes
A graphic designer's fantasy world | ones characters
【每日一题】棋盘问题
[unity note] basic lighting in l4unity
Symmetric encryption, certificate encryption
Can I take the CPDA data analyst certificate for 0 foundation
leetcode:437. 路径总和 III【dfs 选还是不选?】
I changed to a programmer at the age of 31. Now I'm 34. Let me talk about my experience and some feelings
如何防止网站被黑客入侵篡改
洛谷P3236 [HNOI2014]画框 题解
Ad20 supplementary note 3 - shortcut key + continuous update
ZigBee CC2530 minimum system and register configuration (1)