DEV Community

Faris Durrani
Faris Durrani

Posted on

Changing pod instances in Kubernetes in OKE

Say you followed my instructions to deploy a React app to the Oracle Cloud Infrastructure (OCI) Container Engine for Kubernetes (OKE)

Now you made some changes that require you to change the OCI Compute Instances used by the pods. Some cases where this can be required is when you change the number of replicas or version of your OKE node pools.

We assume the new OKE pods have been manually/automatically created.

When this happens, you need to update the OCI Load Balancer to use the correct Backend IP address and port in order for the load balancer to properly route external connections to the correct Compute Instance.

How to ensure the Load Balancer routes the traffic to the new pods

In the OCI Console, go to:
> Load Balancers
> (select your OKE Load Balancer)
> Backend sets
> (select your desired set, e.g., TCP-80)
> Backends

Add your new Backend IP address and Port. Select from the given list of Backends and put down the correct port number.

Example

Say you currently have this on your kubectl get all:
Screenshot of kubectl get all

As you can see, I have a container running on port 80 and another in port 8000.

In the Load Balancer page, I need to make sure the Backends are pointing to the correct Instance IP address and port numbers.

Here is the screenshot of my Load Balancer's backend set for TCP-80:

Backend for TCP-80 on LB

The port number is 32577 which is equal to the port number forwarded under service/myApp-lb, port listed being 80:32577/TCP.

The IP address which ends in .178 meanwhile is the private IP address of the Instance running this pod, as shown in this screenshot of the Instance:

OKE pod Instance screenshot showing private IP address ending in .178


Safe harbor statement
The information provided on this channel/article/story is solely intended for informational purposes and cannot be used as a part of any contractual agreement. The content does not guarantee the delivery of any material, code, or functionality, and should not be the sole basis for making purchasing decisions. The postings on this site are my own and do not necessarily reflect the views or work of Oracle or Mythics, LLC.

This work is licensed under a Creative Commons Attribution 4.0 International License.

Top comments (0)