#test
[root@PROXY-150.109.116.3-HK 22:27 ~/ywgx/Deploy-Templates] [ * main ]
# cat *
version: "3.9"
services:
etcd:
image: docker.io/bitnami/etcd:3.5
environment:
- ALLOW_NONE_AUTHENTICATION=yes
volumes:
- etcd_data:/bitnami/etcd
volumes:
etcd_data:
driver: local
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo
namespace: {{ .NS }}
labels:
app: mongo
spec:
replicas: 1
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
volumes:
- name: data-ns
persistentVolumeClaim:
claimName: {{ .NS }}
restartPolicy: Always
initContainers:
- name: busybox
image: busybox
command:
- /bin/sh
- -c
- |
mount -o remount rw /proc/sys
sysctl -w net.core.somaxconn=65535
sysctl -w vm.overcommit_memory=1
securityContext:
capabilities:
add:
- SYS_ADMIN
drop:
- ALL
containers:
- name: mongo
image: mongo
ports:
- containerPort: 27017
env:
- name: LANG
value: C.UTF-8
- name: TZ
value: Asia/Shanghai
volumeMounts:
- name: data-ns
mountPath: /data/db
subPath: mongo/data/db
---
apiVersion: v1
kind: Service
metadata:
name: mongo
namespace: {{ .NS }}
spec:
ports:
- name: tcp-27017
port: 27017
protocol: TCP
targetPort: 27017
selector:
app: mongo
sessionAffinity: None
type: ClusterIP
version: "3.9"
services:
mongo:
container_name: mongo
image: mongo
pull_policy: always
restart: always
volumes:
- mongo_data:/data/db
environment:
- TZ=Asia/Shanghai
volumes:
mongo_data:
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
namespace: {{ .NS }}
labels:
app: mysql
spec:
replicas: 1
strategy:
type: Recreate
selector:
matchLabels:
app: mysql
template:
metadata:
labels:
app: mysql
spec:
volumes:
- name: data-ns
persistentVolumeClaim:
claimName: {{ .NS }}
restartPolicy: Always
containers:
- name: mysql
image: mysql
args:
- --default_authentication_plugin=mysql_native_password
- --character-set-server=utf8mb4
- --collation-server=utf8mb4_unicode_ci
env:
- name: MYSQL_ROOT_PASSWORD
value: '123456'
- name: MYSQL_DATABASE
value: 'xxxdb'
- name: MYSQL_USER
value: 'xxxuser'
- name: MYSQL_PASSWORD
value: 'xxxpass'
- name: LANG
value: C.UTF-8
volumeMounts:
- name: data-ns
mountPath: /var/lib/mysql
subPath: mysql/data
- name: data-ns
mountPath: /etc/mysql/mysql.conf.d/mysqld.cnf
subPath: mysql/conf/mysqld.cnf