• 已删除用户
Administrator
发布于 2023-07-24 / 4 阅读
0

K8S部署Redis(单机版)

以下YAML文件从本地搭建的KubeSphere工作负载中导出,可能因关联保密字典Secret、配置字典ConfigMap、服务Service等无法直接运行,仅供参考。

kind: StatefulSet
apiVersion: apps/v1
metadata:
  name: redis
  namespace: supports
  labels:
    app: redis
  annotations:
    kubesphere.io/creator: admin
spec:
  replicas: 1
  selector:
    matchLabels:
      app: redis
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: redis
      annotations:
        kubesphere.io/creator: admin
        kubesphere.io/imagepullsecrets: '{}'
        kubesphere.io/restartedAt: '2023-08-25T06:55:15.025Z'
        logging.kubesphere.io/logsidecar-config: '{}'
    spec:
      volumes:
        - name: host-time
          hostPath:
            path: /etc/localtime
            type: ''
        - name: redis-data
          hostPath:
            path: /mydata/redis/data
            type: ''
        - name: volume-02dt0t
          configMap:
            name: redis-config
            defaultMode: 420
      containers:
        - name: container-redis
          image: 'redis:5'
          command:
            - redis-server
          args:
            - /conf/redis.conf
          ports:
            - name: tcp-6379
              containerPort: 6379
              protocol: TCP
          resources: {}
          volumeMounts:
            - name: host-time
              readOnly: true
              mountPath: /etc/localtime
            - name: redis-data
              mountPath: /data
            - name: volume-02dt0t
              readOnly: true
              mountPath: /conf
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          imagePullPolicy: IfNotPresent
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      dnsPolicy: ClusterFirst
      serviceAccountName: default
      serviceAccount: default
      securityContext: {}
      schedulerName: default-scheduler
  serviceName: redis-y8st
  podManagementPolicy: OrderedReady
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      partition: 0
  revisionHistoryLimit: 10