redis-insight

Ethereal Lv4

redis-insight+redis helm部署配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# templates/NOTES.txt
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "cicd-env-args-serv.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "cicd-env-args-serv.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "cicd-env-args-serv.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "cicd-env-args-serv.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}


# templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "cicd-env-args-serv.fullname" . }}-configmap
data:
redis.conf: |
ignore-warnings ARM64-COW-BUG
appendonly yes
cluster-enabled yes
cluster-config-file /var/lib/redis/nodes.conf
cluster-node-timeout 5000
maxmemory 1G
dir /var/lib/redis
port 6379

# templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: {{ include "cicd-env-args-serv.fullname" . }}
labels:
{{- include "cicd-env-args-serv.labels" . | nindent 4 }}
annotations:
kube-vip.io/loadbalancerIPs: {{ .Values.service.loadbalancerIP }}
spec:
loadBalancerClass: kube-vip.io/kube-vip-class
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.redisport }}
targetPort: redis
protocol: TCP
name: redis
- port: {{ .Values.service.httpport }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "cicd-env-args-serv.selectorLabels" . | nindent 4 }}

# templates/statefulset.yaml
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ include "cicd-env-args-serv.fullname" . }}
labels:
{{- include "cicd-env-args-serv.labels" . | nindent 4 }}
spec:
serviceName: {{ include "cicd-env-args-serv.fullname" . }}
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "cicd-env-args-serv.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "cicd-env-args-serv.labels" . | nindent 8 }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.redisrepository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: TZ
value: "Asia/Shanghai"
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
ports:
- name: redis
containerPort: {{ .Values.service.redisport }}
protocol: TCP
volumeMounts:
- name: "config-map"
mountPath: "/etc/redis"
- name: "data"
mountPath: "/data"
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: {{ .Chart.Name }}-http
image: "{{ .Values.image.httprepository }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- with .Values.customCommand }}
command:
{{- range .command }}
- {{ . | quote }}
{{- end }}
args:
{{- range .args }}
- {{ . | quote }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: 5540
protocol: TCP
{{- with .Values.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
- name: http-volume
mountPath: /data
{{- with .Values.volumeMounts }}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: conf
emptyDir: {}
- name: config-map
configMap:
name: {{ include "cicd-env-args-serv.fullname" . }}-configmap
items:
- key: "redis.conf"
path: "redis.conf"
{{- with .Values.volumes }}
{{- toYaml . | nindent 6 }}
{{- end }}
persistentVolumeClaimRetentionPolicy:
whenDeleted: Retain
whenScaled: Retain
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 10000Gi
- metadata:
name: http-volume
spec:
accessModes:
- ReadWriteOnce
storageClassName: local-path
resources:
requests:
storage: 10000Gi

# values.yaml
# Default values for redis.-all
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

replicaCount: 1

image:
redisrepository: redis:6.0.6
httprepository: redis/redisinsight
pullPolicy: IfNotPresent

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""

podAnnotations: {}
podLabels: {}

service:
type: LoadBalancer
redisport: 6379
httpport: 80
loadbalancerIP: 10.2.89.32

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

livenessProbe: []

readinessProbe: []
# Additional volumes on the output Deployment definition.
volumes: []
# - name: foo
# secret:
# secretName: mysecret
# optional: false

# Additional volumeMounts on the output Deployment definition.
volumeMounts: []
# - name: foo
# mountPath: "/etc/foo"
# readOnly: true

nodeSelector: {}

tolerations: []

affinity: {}

  • Title: redis-insight
  • Author: Ethereal
  • Created at: 2024-11-20 00:19:47
  • Updated at: 2024-11-20 00:26:01
  • Link: https://ethereal-o.github.io/2024/11/20/redis-insight/
  • License: This work is licensed under CC BY-NC-SA 4.0.
 Comments
On this page
redis-insight