当前位置:网站首页>Tke (k8s) deploy MySQL using CFS storage
Tke (k8s) deploy MySQL using CFS storage
2022-07-19 13:51:00 【Chenjingwei】
** precondition
1, establish CFS example
2, Permission group Visiting address : * User rights are :no_root_squash read-write permission : Reading and writing
/var/lib/mysql File properties under Directory All are 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)You need to change the permission group of the file system to no_all_squash The visiting user will first match with the local user , Map to anonymous user or user group after matching failure ;
yaml file :
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
---
## Intranet type 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: LoadBalancerView deployment results
[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 Mode deployment :
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边栏推荐
- Onvif protocol related: 2.1.3 get the stream address in none mode
- onvif协议相关:3.1.4 Digest方式获取流地址
- ArrayList underlying analysis
- 【ACWing】2492. HH的项链
- (附源码)多种机器学习模型(KNN\LR\RF\Ada\Xg\GBDT...)下的降水降尺度中的模型训练
- Importerror: DLL load failed while importing win32api: the specified program cannot be found.
- The cloud audit service CTS is a paid service. The paid items include the opening of tracker, event tracking, storage and retrieval of events within 7 days and other related fees
- AcWing 134. 双端队列
- asterisk:No compatible codecs, not accepting this offer!
- Qt之使用QLisView实现QQ登录历史列表
猜你喜欢

【7.15】代码源 -【整齐的数组2】【三进制循环】【树上逆序对】【蜗蜗的数列】
![[7.15] code source - [neat array 2] [ternary cycle] [reverse pair on tree] [sequence of cochlea]](/img/86/8300586819e76502134e8467dc28a3.png)
[7.15] code source - [neat array 2] [ternary cycle] [reverse pair on tree] [sequence of cochlea]

No.6 representation and operation of floating point numbers

QT use qlisview to realize QQ login history list

【Acwing】第60场周赛 题解
![Codeforce:a. doremy's IQ [reverse greed]](/img/3d/065f9f1cbd857d324b6ed074d1afbf.png)
Codeforce:a. doremy's IQ [reverse greed]

uniapp 高德地图定位功能

onvif协议相关:2.1.2 none方式获取截图url

Simulation of overvoltage protection (OVP) circuit based on PMOS

No.3汇编进阶
随机推荐
这些年我开源的几个小项目
卤味店,如何在低线城市挣钱
TKE(K8S)部署mysql使用CFS存储
【7.9】代码源 -【选数】【序列操作】【Minimum Or Spanning Tree】
asterisk: rejected because extension not found in context ‘from-ipphone‘
面试记录
CBS类型PVC回收策略
【7.8】Educational Codeforces Round 131 (Rated for Div. 2)
【码蹄集新手村 600 题】针对于字符串的格式化控制,即字符串的宽度与精度
Programming examples of stm32f1 and stm32subeide -mpu-6050 six axis (gyroscope + accelerometer) drive
[postgraduate entrance examination vocabulary training camp] day 7 - second, attract, current, collect, simple, communicate, vocation
【CANN训练营】昇腾AI基础知识介绍
Framework construction of business card management
[code hoof set novice village question 600] format specifier of float and double
[code hoof set novice village question 600] how to reverse the order of integers
Codeforce:a. difference operations [mathematical thinking]
【7.12】Codeforces Round #806 (Div. 4)
Onvif protocol related: 4.1.1 WS username token method to obtain wsusernametokenbean
【6.15】Codeforces Round #798 (Div. 2)
【码蹄集新手村 600 题】输出时的左对齐,右对齐