简体   繁体   中英

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. In the stanalone.xml of the wildfly, the connection to datasources are defined as follows:

<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&amp;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. But currently i observed that inte.net is not able to reach my pods. I am trying with

ping google.com

It is not giving response as expected. Already I am using LoadBalancer services to expose the ports.

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. If you want to change the ip adress in the cidr, then first make changes in the kube_flannel.yaml file.

Otherwise, it will result in the no inte.net availability of the pods. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM