so I have deploy redis database service in minikube with helm chart bitnami
https://github.com/bitnami/charts/tree/main/bitnami/redis
but I'm unable to connect it with redisinsight
kubectl get services --all-namespaces
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d10h
default redisinsight-service LoadBalancer 10.103.32.34 <pending> 80:31196/TCP 40m
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 2d10h
kubernetes-dashboard dashboard-metrics-scraper ClusterIP 10.106.115.247 <none> 8000/TCP 2d10h
kubernetes-dashboard kubernetes-dashboard ClusterIP 10.111.250.58 <none> 80/TCP 2d10h
prefect prefect-postgresql ClusterIP 10.106.145.244 <none> 5432/TCP 39h
prefect prefect-postgresql-hl ClusterIP None <none> 5432/TCP 39h
prefect prefect-server ClusterIP 10.110.247.9 <none> 4200/TCP 39h
redis redis-headless ClusterIP None <none> 6379/TCP 10h
redis redis-master ClusterIP 10.96.27.187 <none> 6379/TCP 10h
redis redis-replicas ClusterIP 10.104.12.70 <none> 6379/TCP 10h
kubectl get pod --all-namespaces -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default redisinsight-9dc76bb66-hhf75 1/1 Running 0 12h 10.244.0.17 minikube <none> <none>
kube-system coredns-5d78c9869d-kth76 1/1 Running 0 2d22h 10.244.0.2 minikube <none> <none>
kube-system etcd-minikube 1/1 Running 0 2d22h 192.168.49.2 minikube <none> <none>
kube-system kube-apiserver-minikube 1/1 Running 0 2d22h 192.168.49.2 minikube <none> <none>
kube-system kube-controller-manager-minikube 1/1 Running 0 2d22h 192.168.49.2 minikube <none> <none>
kube-system kube-proxy-m8zht 1/1 Running 0 2d22h 192.168.49.2 minikube <none> <none>
kube-system kube-scheduler-minikube 1/1 Running 0 2d22h 192.168.49.2 minikube <none> <none>
kube-system storage-provisioner 1/1 Running 1 (2d22h ago) 2d22h 192.168.49.2 minikube <none> <none>
kubernetes-dashboard dashboard-metrics-scraper-5dd9cbfd69-lsj94 1/1 Running 0 2d22h 10.244.0.4 minikube <none> <none>
kubernetes-dashboard kubernetes-dashboard-5c5cfc8747-j66x2 1/1 Running 0 2d22h 10.244.0.3 minikube <none> <none>
local-path-storage local-path-provisioner-bf548cc96-q2vb4 1/1 Running 0 15h 10.244.0.16 minikube <none> <none>
prefect prefect-postgresql-0 1/1 Running 0 2d3h 10.244.0.10 minikube <none> <none>
prefect prefect-server-6f58d4bd95-rbh5c 1/1 Running 0 2d3h 10.244.0.11 minikube <none> <none>
redis redis-master-0 1/1 Running 0 22h 10.244.0.13 minikube <none> <none>
redis redis-replicas-0 1/1 Running 0 22h 10.244.0.12 minikube <none> <none>
redis redis-replicas-1 1/1 Running 0 22h 10.244.0.14 minikube <none> <none>
redis redis-replicas-2 1/1 Running 0 22h 10.244.0.15 minikube <none> <none>
I tried first to connect on desktop app with a portforward on redis-master :
kubectl port-forward -n redis svc/redis-master 8080:6379
Forwarding from 127.0.0.1:8080 -> 6379
Forwarding from [::1]:8080 -> 6379
Handling connection for 8080
for the description of redis service:
kubectl describe service redis -n redis
Name: redis-headless
Namespace: redis
Labels: app.kubernetes.io/instance=redis
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=redis
helm.sh/chart=redis-17.14.3
Annotations: <none>
Selector: app.kubernetes.io/instance=redis,app.kubernetes.io/name=redis
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: None
IPs: None
Port: tcp-redis 6379/TCP
TargetPort: redis/TCP
Endpoints: 10.244.0.12:6379,10.244.0.13:6379,10.244.0.14:6379 + 1 more...
Session Affinity: None
Events: <none>
Name: redis-master
Namespace: redis
Labels: app.kubernetes.io/component=master
app.kubernetes.io/instance=redis
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=redis
helm.sh/chart=redis-17.14.3
Annotations: <none>
Selector: app.kubernetes.io/component=master,app.kubernetes.io/instance=redis,app.kubernetes.io/name=redis
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.96.27.187
IPs: 10.96.27.187
Port: tcp-redis 6379/TCP
TargetPort: redis/TCP
Endpoints: 10.244.0.13:6379
Session Affinity: None
Events: <none>
Name: redis-replicas
Namespace: redis
Labels: app.kubernetes.io/component=replica
app.kubernetes.io/instance=redis
app.kubernetes.io/managed-by=Helm
app.kubernetes.io/name=redis
helm.sh/chart=redis-17.14.3
Annotations: <none>
Selector: app.kubernetes.io/component=replica,app.kubernetes.io/instance=redis,app.kubernetes.io/name=redis
Type: ClusterIP
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.104.12.70
IPs: 10.104.12.70
Port: tcp-redis 6379/TCP
TargetPort: redis/TCP
Endpoints: 10.244.0.12:6379,10.244.0.14:6379,10.244.0.15:6379
Session Affinity: None
Events: <none>
when I try to connect to redis in the redis insight UI I got this (I tried port forward on the pod directly too instead of the service)
host : 127.0.0.1 port : 8080 no password
after that I deployed redisinsight directly in my minikube and try to connect it with internal host with the first yaml there https://docs.redis.com/latest/ri/installing/install-k8s/
there my script pulumi-python where I declare the helm chart deployment of redis database :
import pulumi
from pulumi_kubernetes import Provider
from pulumi_kubernetes.helm.v3 import Chart, ChartOpts,FetchOpts
from pulumi_kubernetes.core.v1 import Namespace
from functions import ConfigYML
redis_namespace = Namespace("redis",metadata={'name':"redis"})
redis_chart = Chart(
"redis",
ChartOpts(
chart="redis",
fetch_opts=FetchOpts(
repo="https://charts.bitnami.com/bitnami", # Updated repository
),
namespace=redis_namespace.metadata["name"],
values={
"usePassword": False,
},
),
pulumi.ResourceOptions(depends_on=[redis_namespace])
)
usePassword
is false
I shouldn't have any password to set
furthermore in my terminal when I try to connect to the database with redis-cli
command it seem working
redis-cli -h localhost -p 8080
localhost:8080>
I have tried your setup. You need to set auth.enabled
to False
to disable authentication for Redis Bitnami chart.
Here's a sample setup:
import pulumi
import pulumi_kubernetes as kubernetes
config = pulumi.Config()
k8s_namespace = config.get("k8sNamespace", "default")
app_labels = {
"app": "redis-app",
}
# Create a namespace (user supplies the name of the namespace)
redis_ns = kubernetes.core.v1.Namespace(
"redis",
metadata=kubernetes.meta.v1.ObjectMetaArgs(
labels=app_labels,
name=k8s_namespace,
)
)
# Use Helm to install the Redis chart
redis_chart = kubernetes.helm.v3.Release(
"redis",
chart="redis",
namespace=redis_ns.metadata.name,
repository_opts=kubernetes.helm.v3.RepositoryOptsArgs(
repo="https://charts.bitnami.com/bitnami",
),
skip_crds=True,
# values={
# "usePassword": False
# }
values={
"auth": {
"enabled": False
}
}
)
# Export some values for use elsewhere
pulumi.export("name", redis_chart.name)
Pods:
$ k get po -n redis
NAME READY STATUS RESTARTS AGE
redis-69a473da-master-0 1/1 Running 0 6m12s
redis-69a473da-replicas-0 1/1 Running 0 6m12s
redis-69a473da-replicas-1 1/1 Running 0 5m35s
redis-69a473da-replicas-2 1/1 Running 0 5m13s
Portforward:
$ k port-forward -n redis redis-69a473da-master-0 8081:6379
Forwarding from 127.0.0.1:8081 -> 6379
Forwarding from [::1]:8081 -> 6379
Handling connection for 8081
Redis cli:
$ redis-cli -p 8081
127.0.0.1:8081>
When I set usePassword
to False
and don't pass auth.enabled
, I get redis with authentication enabled.
redis-cli when bitnami chart uses usePassword=False
instead of auth.enabled=False
:
$ redis-cli -p 8081
127.0.0.1:8081> KEYS *
(error) NOAUTH Authentication required.
Regarding the redis-cli connection at the end, did any commands succeed, or you got any protocol errors? It could be that redis-cli connected to RedisInsight v2's 8080 port or any other existing service that uses 8080 tcp port.