K8S部署单机Redis
cat <<EOF | kubectl apply -f -kind: ConfigMapapiVersion: v1metadata:name: redis-test-confignamespace: basic-appslabels:app: redis-testdata:redis.conf: |-dir /dataport 6379bind 0.0.0.0appendonly
·
cat <<EOF | kubectl apply -f -
kind: ConfigMap
apiVersion: v1
metadata:
name: redis-test-config
namespace: basic-apps
labels:
app: redis-test
data:
redis.conf: |-
dir /data
port 6379
bind 0.0.0.0
appendonly yes
protected-mode no
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-test
namespace: basic-apps
labels:
app: redis-test
spec:
replicas: 1
selector:
matchLabels:
app: redis-test
template:
metadata:
labels:
app: redis-test
spec:
containers:
- name: redis-test
image: redis:5.0.8
command:
- "sh"
- "-c"
- "redis-server /usr/local/etc/redis/redis.conf"
ports:
- containerPort: 6379
resources:
limits:
cpu: 1000m
memory: 1024Mi
requests:
cpu: 100m
volumeMounts:
- name: config
mountPath: /usr/local/etc/redis/redis.conf
subPath: redis.conf
volumes:
- name: config
configMap:
name: redis-test-config
---
apiVersion: v1
kind: Service
metadata:
name: redis-test
namespace: basic-apps
labels:
app: redis-test
spec:
type: ClusterIP
ports:
- name: redis-6379
port: 6379
selector:
app: redis-test
EOF
更多推荐
已为社区贡献4条内容
所有评论(0)