blob: a680c72585aa1eabc4db20eeae8a77b43f7de55d [file] [log] [blame]
Tinoj Josephdd1fd9d2022-08-01 23:59:26 +05301** Please be patient while the chart is being deployed **
2
3{{- if contains .Values.master.service.type "LoadBalancer" }}
4{{- if not .Values.usePassword }}
5{{ if and (not .Values.networkPolicy.enabled) (.Values.networkPolicy.allowExternal) }}
6
7-------------------------------------------------------------------------------
8 WARNING
9
10 By specifying "master.service.type=LoadBalancer" and "usePassword=false" you have
11 most likely exposed the Redis(TM) service externally without any authentication
12 mechanism.
13
14 For security reasons, we strongly suggest that you switch to "ClusterIP" or
15 "NodePort". As alternative, you can also switch to "usePassword=true"
16 providing a valid password on "password" parameter.
17
18-------------------------------------------------------------------------------
19{{- end }}
20{{- end }}
21{{- end }}
22
23{{- if and .Values.global.redis.sentinel.enabled (not .Values.global.redis.cluster.enabled)}}
24
25-------------------------------------------------------------------------------
26 WARNING
27
28 Using redis sentinel without a cluster is not supported. A single pod with
29 standalone redis has been deployed.
30
31 To deploy redis sentinel, please use the values "cluster.enabled=true" and
32 "sentinel.enabled=true".
33
34-------------------------------------------------------------------------------
35{{- end }}
36
37{{- if .Values.global.redis.cluster.enabled }}
38{{- if .Values.global.redis.sentinel.enabled }}
39Redis can be accessed via port {{ .Values.sentinel.service.redisPort }} on the following DNS name from within your cluster:
40
41{{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} for read only operations
42
43For read/write operations, first access the Redis(TM) Sentinel cluster, which is available in port {{ .Values.sentinel.service.sentinelPort }} using the same domain name above.
44
45{{- else }}
46Redis(TM) can be accessed via port {{ .Values.redisPort }} on the following DNS names from within your cluster:
47
48{{ template "redis.fullname" . }}-master.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} for read/write operations
49{{ template "redis.fullname" . }}-slave.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} for read-only operations
50{{- end }}
51
52{{- else }}
53Redis(TM) can be accessed via port {{ .Values.redisPort }} on the following DNS name from within your cluster:
54
55{{ template "redis.fullname" . }}-master.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
56
57{{- end }}
58
59{{ if .Values.usePassword }}
60To get your password run:
61
62 export REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "redis.secretName" . }} -o jsonpath="{.data.redis-password}" | base64 --decode)
63{{- end }}
64
65To connect to your Redis(TM) server:
66
671. Run a Redis(TM) pod that you can use as a client:
68
69{{- if .Values.tls.enabled }}
70 kubectl run --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }}-client --restart='Never' --env REDIS_PASSWORD=$REDIS_PASSWORD --image {{ template "redis.image" . }} --command -- sleep infinity
71
72 Copy your TLS certificates to the pod:
73
74 kubectl cp --namespace {{ .Release.Namespace }} /path/to/client.cert {{ template "redis.fullname" . }}-client:/tmp/client.cert
75 kubectl cp --namespace {{ .Release.Namespace }} /path/to/client.key {{ template "redis.fullname" . }}-client:/tmp/client.key
76 kubectl cp --namespace {{ .Release.Namespace }} /path/to/CA.cert {{ template "redis.fullname" . }}-client:/tmp/CA.cert
77
78 Use the following command to attach to the pod:
79
80 kubectl exec --tty -i {{ template "redis.fullname" . }}-client \
81 {{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}--labels="{{ template "redis.fullname" . }}-client=true" \{{- end }}
82 --namespace {{ .Release.Namespace }} -- bash
83{{- else }}
84 kubectl run --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }}-client --rm --tty -i --restart='Never' \
85 {{ if .Values.usePassword }} --env REDIS_PASSWORD=$REDIS_PASSWORD \{{ end }}
86 {{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}--labels="{{ template "redis.fullname" . }}-client=true" \{{- end }}
87 --image {{ template "redis.image" . }} -- bash
88{{- end }}
89
902. Connect using the Redis(TM) CLI:
91
92{{- if .Values.global.redis.cluster.enabled }}
93 {{- if .Values.global.redis.sentinel.enabled }}
94 redis-cli -h {{ template "redis.fullname" . }} -p {{ .Values.sentinel.service.redisPort }}{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }} # Read only operations
95 redis-cli -h {{ template "redis.fullname" . }} -p {{ .Values.sentinel.service.sentinelPort }}{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }} # Sentinel access
96 {{- else }}
97 redis-cli -h {{ template "redis.fullname" . }}-master{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
98 redis-cli -h {{ template "redis.fullname" . }}-slave{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
99 {{- end }}
100{{- else }}
101 redis-cli -h {{ template "redis.fullname" . }}-master{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
102{{- end }}
103
104{{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}
105Note: Since NetworkPolicy is enabled, only pods with label
106{{ template "redis.fullname" . }}-client=true"
107will be able to connect to redis.
108{{- else -}}
109
110To connect to your database from outside the cluster execute the following commands:
111
112{{- if contains "NodePort" .Values.master.service.type }}
113
114 export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
115 export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "redis.fullname" . }}-master)
116 redis-cli -h $NODE_IP -p $NODE_PORT {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
117
118{{- else if contains "LoadBalancer" .Values.master.service.type }}
119
120 NOTE: It may take a few minutes for the LoadBalancer IP to be available.
121 Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "redis.fullname" . }}'
122
123 export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
124 redis-cli -h $SERVICE_IP -p {{ .Values.master.service.port }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
125
126{{- else if contains "ClusterIP" .Values.master.service.type }}
127
128 kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "redis.fullname" . }}-master {{ .Values.redisPort }}:{{ .Values.redisPort }} &
129 redis-cli -h 127.0.0.1 -p {{ .Values.redisPort }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }}{{ if .Values.tls.enabled }} --tls --cert /tmp/client.cert --key /tmp/client.key --cacert /tmp/CA.cert{{ end }}
130
131{{- end }}
132{{- end }}
133
134{{ include "redis.checkRollingTags" . }}
135
136{{- include "redis.validateValues" . }}