redis.yaml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. apiVersion: apps/v1
  2. kind: Deployment
  3. metadata:
  4. name: pouchlab-redis
  5. namespace: pouchlab
  6. labels:
  7. app: pouchlab-redis
  8. spec:
  9. replicas: 1
  10. selector:
  11. matchLabels:
  12. app: pouchlab-redis
  13. template:
  14. metadata:
  15. labels:
  16. app: pouchlab-redis
  17. spec:
  18. nodeSelector:
  19. kubernetes.io/hostname: k8s-node1
  20. containers:
  21. - name: redis
  22. image: k8s.device.wenhq.top:8583/docker_r/redis:7-alpine-amd64
  23. imagePullPolicy: IfNotPresent
  24. args: ["redis-server", "--maxmemory", "128mb", "--maxmemory-policy", "allkeys-lru", "--save", ""]
  25. ports:
  26. - name: redis
  27. containerPort: 6379
  28. resources:
  29. requests:
  30. cpu: 20m
  31. memory: 32Mi
  32. limits:
  33. cpu: 200m
  34. memory: 192Mi
  35. readinessProbe:
  36. exec:
  37. command: ["redis-cli", "ping"]
  38. initialDelaySeconds: 5
  39. periodSeconds: 10
  40. livenessProbe:
  41. exec:
  42. command: ["redis-cli", "ping"]
  43. initialDelaySeconds: 15
  44. periodSeconds: 20
  45. # Redis 仅作缓存(key 全部可重建),无需持久化卷
  46. volumes: []
  47. ---
  48. apiVersion: v1
  49. kind: Service
  50. metadata:
  51. name: pouchlab-redis
  52. namespace: pouchlab
  53. labels:
  54. app: pouchlab-redis
  55. spec:
  56. type: ClusterIP
  57. selector:
  58. app: pouchlab-redis
  59. ports:
  60. - name: redis
  61. port: 6379
  62. targetPort: 6379