Spring Boot Docker Image not able to connect to external Redis Cluster when run in Kubernetes Pod

6/1/2020

I have created a Docker Image. It is not able to connect to external Redis Cluster when I am deploying the image to the Kubernetes cluster. But it is running fine in Docker container. The following are my configuration yaml.

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
   creationTimestamp: null
   labels:
       app: testappname
   name: testappname
spec:
   replicas: 1
   selector:
       matchLabels:
           app: testappname
strategy: {}
template:
metadata:
  creationTimestamp: null
  labels:
    app: testappname
spec:
  containers:
  - image: imageName:latest
    name: testappname
    resources: {}
status: {}

service.yaml

apiVersion: v1
kind: Service
metadata:
    creationTimestamp: null
    labels:
        app: testappname
    name: testappname
spec:
    ports:
    - name: 8089-8089
      port: 8089
      protocol: TCP
      targetPort: 8089
selector:
    app: testappname
type: ClusterIP
status:
    loadBalancer: {}
-- acsh
docker
java
kubernetes
spring-boot

0 Answers