vim redis.yml
apiVersion: v1
kind: Namespace
metadata:
name: lamp-cloud-k8s
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: lamp-cloud-k8s
labels:
name: redis
spec:
replicas: 1
selector:
matchLabels:
name: redis
template:
metadata:
labels:
name: redis
spec:
containers:
- name: redis
image: redis:5.0.5
volumeMounts:
- name: redis-config
mountPath: "/usr/local/etc/redis"
- name: redis-data
mountPath: "/data"
command:
- "redis-server"
args:
- "/usr/local/etc/redis/redis.conf"
volumes:
- name: redis-config
hostPath:
path: /data/lamp-cloud-k8s/redis-config
type: DirectoryOrCreate
- name: redis-data
hostPath:
path: /data/lamp-cloud-k8s/redis-data
type: DirectoryOrCrea