标签:pre pid template toc version 设置 names 配置 pps
apiVersion: v1
kind: Namespace
metadata:
name: dev
apiVersion: v1 kind: ConfigMap metadata: namespace: dev name: redis-conf data: redis.conf: | bind 0.0.0.0 port 6379 #requirepass 111111 #设置认证密码 appendonly yes cluster-config-file nodes-6379.conf pidfile /redis/log/redis-6379.pid cluster-config-file /redis/conf/redis.conf dir /redis/data/ logfile /redis/log/redis-6379.log cluster-node-timeout 5000 protected-mode no
apiVersion: apps/v1 kind: StatefulSet metadata: name: redis namespace: dev spec: replicas: 1 serviceName: redis selector: matchLabels: name: redis template: metadata: labels: name: redis spec: initContainers: - name: init-redis image: hub.ityy.ultrapower.com.cn:5050/middleware/busybox:1.1.1 #初始化容器镜像 command: [‘sh‘, ‘-c‘, ‘mkdir -p /redis/log/;mkdir -p /redis/conf/;mkdir -p /redis/data/‘] volumeMounts: - name: data mountPath: /redis/ containers: - name: redis image: hub.ityy.ultrapower.com.cn:5050/middleware/redis:4.0.6 imagePullPolicy: IfNotPresent command: - sh - -c - "exec redis-server /redis/conf/redis.conf" ports: - containerPort: 6379 name: redis protocol: TCP volumeMounts: - name: redis-config mountPath: /redis/conf/ - name: data mountPath: /redis/ volumes: - name: redis-config configMap: name: redis-conf - name: data hostPath: path: /app/ #挂载宿主机目录 nodeSelector: domain: dev #选择要部署的固定节点
kind: Service apiVersion: v1 metadata: namespace: dev labels: name: redis name: redis spec: type: NodePort ports: - name: redis port: 6379 targetPort: 6379 nodePort: 31379 selector: name: redis
标签:pre pid template toc version 设置 names 配置 pps
原文地址:https://www.cnblogs.com/yanxinjiang/p/13974715.html