安裝脚本 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697cat >> redis.yaml << EOFkind: ConfigMapapiVersion: v1metadata: name: redis-config labels: app: redis namespace: common-toolsdata: redis.conf: |- dir /srv port 6379 bind 0.0.0.0 appendonly yes daemonize no #protected-mode no requirepass yunhe2020 pidfile /srv/redis-6379.pid---apiVersion: apps/v1kind: Deploymentmetadata: name: redis labels: app: redis namespace: common-toolsspec: replicas: 1 selector: matchLabels: app: redis template: metadata: labels: app: redis spec: containers: - name: redis image: redis:3.0.7 command: - "sh" - "-c" - "redis-server /usr/local/redis/redis.conf" ports: - containerPort: 6379 resources: limits: cpu: 1000m memory: 1024Mi requests: cpu: 1000m memory: 1024Mi livenessProbe: tcpSocket: port: 6379 initialDelaySeconds: 300 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 readinessProbe: tcpSocket: port: 6379 initialDelaySeconds: 5 timeoutSeconds: 1 periodSeconds: 10 successThreshold: 1 failureThreshold: 3 volumeMounts: - name: config mountPath: /usr/local/redis/redis.conf subPath: redis.conf volumes: - name: config configMap: name: redis-config---apiVersion: v1kind: Servicemetadata: name: redis namespace: common-tools labels: app: redisspec: type: NodePort ports: - name: tcp port: 6379 nodePort: 30379 selector: app: redisEOF Master执行命令进行安装 1kubectl apply -f redis.yaml