Kubernetes pods failing using deployments, where as my docker run is getting success using proxy configurations

8/14/2020

Why is my docker run success and k8s fails to take the proxies

My Docker container runs by executing a docker run. Where as during my container boots it executes my rest api call under the Spring boot API instance before it get get started in a specfic port.

During the API call it requires a proxy to bypass and access the endpoint, and load all my property details.

Where as i am getting is happened when i run it using the docker run. But fails when the same is ran under kubernetes.

Logs on failure

2020-08-13 07:26:21.096 ERROR 1 --- [           main] c.e.f.utils.config.FSFConfigRestClient   : Could not connect to iConfig after 3 retries
2020-08-13 07:26:21.101 ERROR 1 --- [           main] c.e.f.utils.config.FSFConfigRestClient   : Error occured while fetching configurations from e-config service @ http://jconfig.ezpaas-nonprod.***.com/econfig/ 

due to I/O error on POST request for "http://jconfig.ezpaas-nonprod.***.com/econfig/public/rest-less-api/query-configurations"

Below is my Docker file

FROM openjdk:8-jdk-alpine
ENV HTTP_PROXY "http://http.proxy.abc.com:8000"
ENV HTTPS_PROXY "http://http.proxy.abc.com:8000"
ENV NO_PROXY "localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,192.168.10.0/24,example.com"
MAINTAINER @@@@@@ ***@***.com
EXPOSE 8080
ARG JAR_FILE=/daas-service.jar
ADD ${JAR_FILE} app.jar
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -Dezpaas.config.tenantName=WI_MID_TIER -Dezpaas.config.categories=WI_DCDST:WI_ESTDS:TDS:DEV -jar /app.jar $my_params"]

Below is my Docker Run which is success

docker run --restart=unless-stopped \
  -p 80:80 \
  -e HTTP_PROXY="http://http.proxy.abc.com:8000" \
  -e HTTPS_PROXY="http://http.proxy.abc.com:8000" \
  -e NO_PROXY="localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,192.168.10.0/24,example.com" \
  docker.abc.com/abc-ap119038/daas-service:0.0.1

Below is my deployment which is failing

apiVersion: apps/v1
kind: Deployment
metadata:
  name: daas-service
  namespace: com-abc-tds-dev
spec:
  replicas: 3
  selector:
    matchLabels:
      app: daas-service
  template:
    metadata:
      name:
      labels:
        app: daas-service
    spec:
      nodeName: kmaster
      containers:
      - name: daas-service
        image: docker.abc.com/abc-ap119038/daas-service:0.0.1
        imagePullPolicy: Never
        env:
        - name: "HTTP_PROXY"
          value: "http://http.proxy.abc.com:8000"
        - name: "HTTPS_PROXY"
          value: "http://http.proxy.abc.com:8000"
        - name: "NO_PROXY"
          value: "localhost,127.0.0.1,0.0.0.0,10.0.0.0/8,192.168.10.0/24,example.com"

Am i missing out something here. Still wondering how my docker run is success and deployments fail in k8s

-- Ravi
docker
java
kubernetes

1 Answer

8/27/2020

You have to untaint the master so you can run pods. Execute following command:

$ kubectl taint nodes kmaster node-role.kubernetes.io/master-

Take a look: single-node-kubernetes-setup.

-- Malgorzata
Source: StackOverflow