** Please be patient while the chart is being deployed ** {{- if contains .Values.master.service.type "LoadBalancer" }} {{- if not .Values.usePassword }} {{ if and (not .Values.networkPolicy.enabled) (.Values.networkPolicy.allowExternal) }} ------------------------------------------------------------------------------- WARNING By specifying "master.service.type=LoadBalancer" and "usePassword=false" you have most likely exposed the Redis service externally without any authentication mechanism. For security reasons, we strongly suggest that you switch to "ClusterIP" or "NodePort". As alternative, you can also switch to "usePassword=true" providing a valid password on "password" parameter. ------------------------------------------------------------------------------- {{- end }} {{- end }} {{- end }} {{- if .Values.cluster.enabled }} Redis can be accessed via port {{ .Values.master.port }} on the following DNS names from within your cluster: {{ template "redis.fullname" . }}-master.{{ .Release.Namespace }}.svc.cluster.local for read/write operations {{ template "redis.fullname" . }}-slave.{{ .Release.Namespace }}.svc.cluster.local for read-only operations {{- else }} Redis can be accessed via port {{ .Values.master.port }} on the following DNS name from within your cluster: {{ template "redis.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local {{- end }} {{ if .Values.usePassword }} To get your password run: export REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }} -o jsonpath="{.data.redis-password}" | base64 --decode) {{- end }} To connect to your Redis server: 1. Run a Redis pod that you can use as a client: kubectl run --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }}-client --rm --tty -i \ {{ if .Values.usePassword }} --env REDIS_PASSWORD=$REDIS_PASSWORD \{{ end }} {{- if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }}--labels="{{ template "redis.name" . }}-client=true" \{{- end }} --image {{ template "redis.image" . }} -- bash 2. Connect using the Redis CLI: {{- if .Values.cluster.enabled }} redis-cli -h {{ template "redis.fullname" . }}-master{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} redis-cli -h {{ template "redis.fullname" . }}-slave{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} {{- else }} redis-cli -h {{ template "redis.fullname" . }}{{ if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} {{- end }} {{ if and (.Values.networkPolicy.enabled) (not .Values.networkPolicy.allowExternal) }} Note: Since NetworkPolicy is enabled, only pods with label {{ template "redis.fullname" . }}-client=true" will be able to connect to redis. {{- else -}} To connect to your database from outside the cluster execute the following commands: {{- if contains "NodePort" .Values.master.service.type }} export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "redis.fullname" . }}-master) redis-cli -h $NODE_IP -p $NODE_PORT {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} {{- else if contains "LoadBalancer" .Values.master.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "redis.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "redis.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') redis-cli -h $SERVICE_IP -p {{ .Values.master.service.nodePort }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} {{- else if contains "ClusterIP" .Values.master.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "redis.name" . }}" -o jsonpath="{.items[0].metadata.name}") kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME {{ .Values.master.port }}:{{ .Values.master.port }} redis-cli -h 127.0.0.1 -p {{ .Values.master.port }} {{- if .Values.usePassword }} -a $REDIS_PASSWORD{{ end }} {{- end }} {{- end }}