Skip to content

Latest commit

 

History

History
76 lines (64 loc) · 1.36 KB

k8s_redis-cache.md

File metadata and controls

76 lines (64 loc) · 1.36 KB

...menustart

...menuend

Deploy a Redis cache to k8s

vi redis-cache.yaml

kubectl -n <name-space> replace -f redis-cache.yaml --force
apiVersion: v1
items:
- apiVersion: apps/v1
  kind: Deployment
  metadata:
    labels:
      k8s-app: redis-cache
    name: redis-cache
  spec:
    replicas: 1
    selector:
      matchLabels:
        k8s-app: redis-cache
    strategy:
      type: RollingUpdate
    template:
      metadata:
        labels:
          k8s-app: redis-cache
      spec:
        containers:
        - args:
          - --maxmemory 370m
          - --maxmemory-policy allkeys-lru
          - --protected-mode no
          - --save ''
          - --appendonly no
          image: redis:4.0.14
          imagePullPolicy: IfNotPresent
          name: redis-cache
          resources:
            limits:
              cpu: "1"
            requests:
              cpu: 100m
              memory: 128Mi
        dnsPolicy: ClusterFirst
        restartPolicy: Always

- apiVersion: v1
  kind: Service
  metadata:
    name: redis-cache
  spec:
    ports:
    - name: 6379-6379-tcp
      port: 6379
      protocol: TCP
      targetPort: 6379
    selector:
      k8s-app: redis-cache
    sessionAffinity: None
    type: ClusterIP

kind: List