apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-deployment
labels:
app: redis
env: prod
spec:
replicas: 1
selector:
matchLabels:
app: redis
env: prod
template:
metadata:
labels:
app: redis
env: prod
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: "kubernetes.io/arch"
operator: "In"
values:
- arm64
tolerations:
- key: "key"
operator: "Equal"
value: "arm"
effect: "NoSchedule"
containers:
- name: redis-container
image: redis:6.2
imagePullPolicy: IfNotPresent
resources:
requests:
memory: "128Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "300m"
volumeMounts:
- name: redis-data
mountPath: /data
ports:
- containerPort: 9090
volumes:
- name: redis-data
nfs:
server: 192.168.0.182
path: "/mnt/nfs1/redis"
---
kind: Service
apiVersion: v1
metadata:
name: redis-service
labels:
app: redis
env: prod
spec:
selector:
app: redis
env: prod
ports:
- name: redis
protocol: TCP
port: 6379
targetPort: 6379
nodePort: 31000
type: NodePort
redis cli:
127.0.0.1:6379> set var1 100
OK
127.0.0.1:6379> get var1
"100"
127.0.0.1:6379> incr var1
(integer) 101
127.0.0.1:6379> get var1
"101"