[英]Kubernetes - No internet coming in pods
I have been working in Kube.netes for a while and I have a docker image of wildfly application.我在 Kube.netes 工作了一段时间,我有一个 docker 的 wildfly 应用程序图像。 In the stanalone.xml of the wildfly, the connection to datasources are defined as follows:
在wildfly的stanalone.xml中,连接datasources的定义如下:
<datasource jta="true" jndi-name="java:/DB" pool-name="DB" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://IP:3306/DB_NAME?zeroDateTimeBehavior=convertToNull&autoReconnect=true</connection-url>
<driver-class>com.mysql.cj.jdbc.Driver</driver-class>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
</datasource>
I have one worker node and 2 replicas of the same pod are running in it.我有一个工作节点,其中运行着同一个 pod 的 2 个副本。 But currently i observed that inte.net is not able to reach my pods.
但目前我观察到 inte.net 无法访问我的 pod。 I am trying with
我正在尝试
ping google.com
平谷歌.com
It is not giving response as expected.它没有按预期给出响应。 Already I am using LoadBalancer services to expose the ports.
我已经在使用LoadBalancer服务来公开端口。
apiVersion: v1
kind: Service
metadata:
name: re-demo
namespace: default
spec:
type: LoadBalancer
selector:
app: re-demo
ports:
- port: 9575
targetPort: 9575
nodePort: 32756
externalTrafficPolicy: Cluster
How can I solve this??我该如何解决这个问题??
There was mistake when I set up the cluster.我设置集群的时候出错了。
kubeadm init --apiserver-advertise-address 10.128.0.12 --pod-network-cidr=10.244.0.0/16
cidr address we should give just like what we have in our kube_flannel.yaml file. cidr 地址,我们应该像我们在kube_flannel.yaml文件中一样给出。 If you want to change the ip adress in the cidr, then first make changes in the
kube_flannel.yaml
file.如果要更改 cidr 中的 ip 地址,请先在
kube_flannel.yaml
文件中进行更改。
Otherwise, it will result in the no inte.net availability of the pods.否则,将导致 pod 无法访问 inte.net。 And we need to use the
hostNetwork =true
property for inte.net connection, but which turn prevents us some running more than one replica of same pod in the same node.我们需要为 inte.net 连接使用
hostNetwork =true
属性,但这又会阻止我们在同一节点中运行同一 pod 的多个副本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.