kubernetes部署redis5.0.6单机版 自定义配置文件 密码

  运维

ConfigMap

apiVersion: v1
kind: ConfigMap
metadata:
  name: redis-conf
data:
  redis.conf: |
        bind 0.0.0.0
        port 6379
        requirepass 123456
        appendonly yes
        cluster-node-timeout 5000
        protected-mode no

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: redis
spec:
  replicas: 1
  selector:
    matchLabels:
      name: redis
  template:
    metadata:
      labels:
        name: redis
    spec:
      containers:
      - name: redis
        image: redis
        imagePullPolicy: IfNotPresent
        command:
        - sh
        - -c
        - "exec redis-server /etc/redis/redis.conf"
        ports:
        - containerPort: 6379
          name: redis
          protocol: TCP
        volumeMounts:
        - name: redis-config
          mountPath: /etc/redis
      volumes:
      - name: redis-config
        configMap:
          name: redis-conf  

svc

kind: Service
apiVersion: v1
metadata:
  name: redis
spec:
  type: NodePort
  ports:
  - name: redis
    port: 6379
    nodePort: 30379
    targetPort: 6379
    protocol: TCP
  selector:
    name: redis

One Reply to “kubernetes部署redis5.0.6单机版 自定义配置文件 密码”

  • kubernetes kubectl批量删除pod:
    kubectl get pods -n mr |grep Evicted | awk ‘{print $1}’ |xargs kubectl delete pod -n mr

LEAVE A COMMENT

发表评论前,请选对水果【Apple=苹果、Banana=香蕉、Pineapple=菠萝、Grapes=葡萄】 Apple...