<p>i have a application ( Let's say Integration-protocol-api)
and this application want to talk to other application, but this application located on another Network (Let's call it Another-Integration-Protocol)<br>
And problem is, on another-integration-protocol side the whitelist exist, which allow to connect to it, only from selected ip addresses.
But my integration-protocol-api is Dockerized and running on Kubernetes cluster, so ip address is changing everyime when i restart my pod.
how can i assign the Public and Static ip to my Kubernetes Pod? </p>

Joom187
<blockquote>
  <p>But my integration-protocol-api is Dockerized and running on Kubernetes cluster, so ip address is changing everyime when i restart my pod. how can i assign the Public and Static ip to my Kubernetes Pod</p>
</blockquote>

<ul>
<li><p>There are several approaches, depending on your actual setup/needs and I'll try to give some options here:</p>

<ul>
<li><p>Tie pod to specific node and expose that node's IP address through service. This would be something along those lines:</p>

<pre><code># Quick deployment/pod manifest node selector (affinity is better)
...
spec:
  nodeSelector:
    kubernetes.io/hostname: my-node-name
...
# Service manifest 
apiVersion: v1
kind: Service
metadata:
  name: svc-myservice
  labels:
    app: myapp
    tier: frontend
spec:
  selector:
    app: myapp
    tier: frontend
  ports:
  - name: tcpserviceport
    protocol: TCP
    port: 8080
    targetPort: 80
  externalIPs:
  - 111.222.222.111
</code></pre>

<p>Pod should be in same namespace, tied to that node via either node selector or affinity rules and have same labels as in selector for service to pick it up. IP address of cluster node with name my-node-name should be 111.222.222.111 in this example, and it would be accessible through port 8080 and that ip address.</p></li>
<li><p>If applicable, expose service through ingress and whitelist ingress public ip only. Depending on your namespace separation you'll reference your pod (wherever it might run) in ingress through corresponding service using either service name (in namespace scope) or FQDN such as:</p>

<pre><code>&lt;service-name&gt;.&lt;namespace-name&gt;.svc.cluster.local
</code></pre></li>
<li><p>Here is good overview of some methods to make it more illustrative from kubernetes docs: <a href="https://kubernetes.io/docs/tutorials/kubernetes-basics/expose-intro/" rel="nofollow noreferrer">https://kubernetes.io/docs/tutorials/kubernetes-basics/expose-intro/</a></p></li>
</ul></li>
</ul>
