I have been learning Kubernetes lately. And I'm trying to use redis but I am getting the following error:
Error:Error -3 connecting to redis:6379. Temporary failure in name resolution.
I'm using:
conn = redis.StrictRedis(host='redis', port=6379)
docker composer:
redis:
image: redis:alpine
ports:
- "6379:6379"
redis-deploy.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis-deploy
spec:
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: redis:alpine
ports:
- containerPort: 6379
service redis:
apiVersion: v1
kind: Service
metadata:
labels:
app: redis
name: redis
spec:
selector:
app: redis
type: NodePort
ports:
- port: 6379
protocol: TCP
kubectl get svc
redis NodePort 10.152.183.209 <none> 6379:32649/TCP 7m31s
EDIT: the image is pulling from docker, here is one of the deployment files.
apiVersion: apps/v1
kind: Deployment
metadata:
name: greeter-client-deploy
spec:
replicas: 10
selector:
matchLabels:
app: greeter-client
minReadySeconds: 10
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 1
maxSurge: 1
template:
metadata:
labels:
app: greeter-client
spec:
containers:
- name: greeter-client
image: seancork92/greeter_client:latest