英文:
Kubernetes pods failing using deployments, where as my docker run is getting success using proxy configurations
问题
以下是您要翻译的内容:
为什么我的 Docker 运行成功,而 Kubernetes 在代理方面失败了
我的 Docker 容器通过执行 docker run 运行。然而,在容器启动时,在 Spring Boot API 实例下执行我的 REST API 调用,然后才在特定端口启动。
在 API 调用期间,它需要代理来绕过并访问终端节点,并加载所有的属性详情。
当我使用 docker run 运行时,一切正常。
但是在 Kubernetes 下运行相同的内容时却失败了。
失败日志
2020-08-13 07:26:21.096 ERROR 1 --- [ main] c.e.f.utils.config.FSFConfigRestClient : 尝试 3 次后无法连接到 iConfig
2020-08-13 07:26:21.101 ERROR 1 --- [ main] c.e.f.utils.config.FSFConfigRestClient : 从 e-config 服务 @ http://jconfig.ezpaas-nonprod.***.com/econfig/ 获取配置时发生错误
由于在 POST 请求 "http://jconfig.ezpaas-nonprod.***.com/econfig/public/rest-less-api/query-configurations" 上出现 I/O 错误。
以下是我的 Dockerfile
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"]
以下是成功的 Docker Run
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
以下是失败的部署
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"
我是否遗漏了什么。我仍在想为什么我的 Docker 运行成功,但在 Kubernetes 部署中失败了。
英文:
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
答案1
得分: 0
你必须取消节点的标记以便可以运行Pod。执行以下命令:
$ kubectl taint nodes kmaster node-role.kubernetes.io/master-
查看:single-node-kubernetes-setup。
英文:
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.
专注分享java语言的经验与见解,让所有开发者获益!
评论