当前位置:网站首页>TKE(K8S)部署mysql使用CFS存储
TKE(K8S)部署mysql使用CFS存储
2022-07-17 19:04:00 【陈敬伟】
**前置条件
1,创建CFS实例
2,权限组 来访地址: * 用户权限是:no_root_squash 读写权限:读写
/var/lib/mysql 目录下的文件属性 都是mysql
[email protected]:/var/lib/mysql# pwd
/var/lib/mysql
[email protected]:/var/lib/mysql# ls -lrt
total 198064
-rw-r----- 1 mysql mysql 50331648 Jul 17 08:22 ib_logfile1
-rw-r----- 1 mysql mysql 8585216 Jul 17 08:22 '#ib_16384_1.dblwr'
drwxr-x--- 2 mysql mysql 4096 Jul 17 08:23 performance_schema
[email protected]:/var/lib/mysql# id mysql
uid=999(mysql) gid=999(mysql) groups=999(mysql)需要将文件系统的权限组修改成 no_all_squash 访问用户会先与本机用户匹配,匹配失败后再映射为匿名用户或用户组;
yaml文件:
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
k8s-app: mysql-cfs-data
qcloud-app: mysql-cfs-data
name: mysql-cfs-data
namespace: storage
spec:
replicas: 1
selector:
matchLabels:
k8s-app: mysql-cfs-data
qcloud-app: mysql-cfs-data
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
k8s-app: mysql-cfs-data
qcloud-app: mysql-cfs-data
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
value: "123456"
image: mysql:5.7.16
imagePullPolicy: IfNotPresent
name: mysql
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 100m
memory: 64Mi
securityContext:
privileged: false
volumeMounts:
- mountPath: /var/lib/mysql
name: mysql-vol
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: qcloudregistrykey
restartPolicy: Always
volumes:
- name: mysql-vol
persistentVolumeClaim:
claimName: cfs-pvc-root
---
##内网型CLB
apiVersion: v1
kind: Service
metadata:
annotations:
service.kubernetes.io/qcloud-loadbalancer-internal-subnetid: subnet-ge8hhr3e
name: mysql-cfs-data
namespace: storage
spec:
externalTrafficPolicy: Cluster
ports:
- name: 3306-3306-tcp
nodePort: 31761
port: 3306
protocol: TCP
targetPort: 3306
selector:
k8s-app: mysql-cfs-data
qcloud-app: mysql-cfs-data
sessionAffinity: None
type: LoadBalancer查看部署结果
[email protected]:/var/lib/mysql# df -h | grep /var
192.168.1.6:/111 10G 241M 9.8G 3% /var/lib/mysql
[email protected]:/var/lib/mysql# ls -lt
total 188452
drwxr-x--- 2 mysql mysql 19 Jul 17 09:28 chen
-rw-r----- 1 mysql mysql 12582912 Jul 17 09:26 ibtmp1
-rw-r----- 1 mysql mysql 50331648 Jul 17 09:25 ib_logfile0
-rw-r----- 1 mysql mysql 79691776 Jul 17 09:25 ibdata1
-rw-r----- 1 mysql mysql 1325 Jul 17 09:25 ib_buffer_pool
drwxr-x--- 2 mysql mysql 8192 Jul 17 09:25 sys
drwxr-x--- 2 mysql mysql 4096 Jul 17 09:25 mysql
drwxr-x--- 2 mysql mysql 8192 Jul 17 09:25 performance_schema
-rw-r----- 1 mysql mysql 56 Jul 17 09:25 auto.cnf
-rw-r----- 1 mysql mysql 50331648 Jul 17 09:25 ib_logfile1StatefulSet方式部署:
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
k8s-app: mysql
qcloud-app: mysql
name: mysql
namespace: cjweichen
spec:
replicas: 1
selector:
matchLabels:
k8s-app: mysql
qcloud-app: mysql
serviceName: ""
template:
metadata:
labels:
k8s-app: mysql
qcloud-app: mysql
spec:
containers:
- env:
- name: MYSQL_ROOT_PASSWORD
value: "123456"
image: mysql:5.7
imagePullPolicy: IfNotPresent
name: mysql
resources: {}
volumeMounts:
- mountPath: /var/lib/mysql
name: nfs
subPath: mysql_docker/data
dnsPolicy: ClusterFirst
imagePullSecrets:
- name: qcloudregistrykey
volumes:
- name: nfs
nfs:
path: /
server: 172.16.3.7边栏推荐
- [7.13] code source - [hungry meals] [path count 2] [function sum]
- NO.2汇编初步
- [7.15] code source - [neat array 2] [ternary cycle] [reverse pair on tree] [sequence of cochlea]
- 【6.15】Codeforces Round #798 (Div. 2)
- STL string find substring
- How to upgrade Flink job gracefully?
- Responsive dream weaving template wine cellar website
- 【考研词汇训练营】Day 7 —— second,attract,current,collect,simple,communicate,vocation
- onvif协议相关:2.1.3 none方式获取流地址
- onvif协议相关:3.1.3 Digest方式获取截图url
猜你喜欢

ImportError: DLL load failed while importing win32api: 找不到指定的程序。

Some common operation commands of the command line and solutions to common errors
![[code hoof set novice village question 600] format specifier of float and double](/img/19/433f794617f3c3c72732f1a4efe252.png)
[code hoof set novice village question 600] format specifier of float and double
![Codeforce:g. good key, bad key [greed]](/img/5e/e34e549c15e2e495d3a274ea8e6f82.png)
Codeforce:g. good key, bad key [greed]

onvif协议相关:4.1.4 WS-Username token方式获取流地址

【码蹄集新手村 600 题】运算符 / 在不同的运算顺序中的类型转换

【考研词汇训练营】Day 7 —— second,attract,current,collect,simple,communicate,vocation

【Acwing】第60场周赛 题解

onvif协议相关:4.1.2 WS-Username token方式获取token

onvif協議相關:4.1.3 WS-Username token方式獲取截圖url
随机推荐
Design and Simulation of anti reverse connection circuit based on MOS transistor
SSH keyless login
【7.8】Educational Codeforces Round 131 (Rated for Div. 2)
"Technology podcast month" day 10: meta podcast: talk about Podcasting
[code hoof set novice village question 600] operator / type conversion in different operation sequences
STL string输出与修改
Onvif protocol related: 2.1.1 get token in none mode
Onvif protocol related: 3.1.1 digest access authorization
Template virtual machine environment preparation
Onvif protocol related: 3.1.2 get the token list in digest mode
Responsive Zhimeng template logistics and freight service website
AcWing 134. 双端队列
eth入门之运行节点
asterisk: rejected because extension not found in context ‘from-ipphone‘
Onvif protocol related: 4.1.1 WS username token method to obtain wsusernametokenbean
STL string复制比较
How to upgrade Flink job gracefully?
[JS reverse crawler] - Youdao translation JS reverse practice
Principle of voice communication network
【动态规划】—— 最长上升子序列模型