<p>By default Kubernetes allow pods to access other pods using the pod IP. </p>

<p>I have 2 pods. Pod1 and Pod2. Pod1 has a mysql server and a PHP application. And Pod2 has a php application. The Pod1 ip is 174.17.0.4, Within the Pod2 the php application can access the mysql server from the address <code>174.17.0.4:3306</code>.</p>

<p>The Pod1 and the Pod2 are 2 different applications. Pod2 doesn't have nothing to do with Pod1. So my concern is if Pod2 got hacked, the hacker can scan the network and brute force attack the Pod1 mysql server.</p>

<p>How can I disallow access to the mysql port <code>3306</code> from outside the pod1?</p>

user3502626
<p>If your cluster setup supports <code>NetworkPolicy</code> resource, you can look into <a href="https://kubernetes.io/docs/concepts/services-networking/network-policies/#the-networkpolicy-resource" rel="nofollow noreferrer">network policy</a>. With it, you can set specific ingress and egress policies to specific pods.</p>
