# Kong OSS - Navigate traffic between 2 different pods of 2 different namespace

**URL:** <https://discuss.konghq.com/t/kong-oss-navigate-traffic-between-2-different-pods-of-2-different-namespace/12435>\
**Category:** Questions\
**Tags:** kubernetes\
**Created:** [February 27, 2024, 6:33am UTC](https://discuss.konghq.com/t/kong-oss-navigate-traffic-between-2-different-pods-of-2-different-namespace/12435 "2024-02-27T06:33:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KongDev](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@KongDev](https://discuss.konghq.com/u/KongDev)\
**Post date:** [February 27, 2024, 6:33am UTC](https://discuss.konghq.com/t/kong-oss-navigate-traffic-between-2-different-pods-of-2-different-namespace/12435/1 "2024-02-27T06:33:08Z")

</div>

Hi All,  
I am new in Kong. As per my POC use case, I need to manage traffic between 2 different pods of 2 different namespace using lua script. Below are related deployments and steps. Can someone please assist, it’ll be great help.

## Kong Installation - helm repo add kong [https://charts.konghq.com](https://charts.konghq.com) helm repo update helm install kong-helm-release kong/kong --create-namespace --namespace kong --set admin.enabled=true --set admin.type=ClusterIP --set admin.http.enabled=true --set ingressController.enabled=true --set ingressController.installCRDs=true --set proxy.type=ClusterIP --set annotations.“[app.kubernetes.io/managed-by"="Helm](http://app.kubernetes.io/managed-by%22=%22Helm)” --set annotations.“meta.helm.sh/release-name”=“kong-helm-release”

## Apps Deployment YAML - apiVersion: v1 kind: Namespace metadata: name: namespace1

## apiVersion: v1 kind: Namespace metadata: name: namespace2

## apiVersion: v1 kind: Service metadata: name: app1 namespace: namespace1 spec: selector: app: app1 ports: - protocol: TCP port: 80 targetPort: 8080

## apiVersion: apps/v1 kind: Deployment metadata: name: app1 namespace: namespace1 spec: replicas: 1 selector: matchLabels: app: app1 template: metadata: labels: app: app1 spec: containers: - name: app1 image: hashicorp/http-echo args: - “-text=app1” ports: - containerPort: 8080

## apiVersion: v1 kind: Service metadata: name: app2 namespace: namespace2 spec: selector: app: app2 ports: - protocol: TCP port: 80 targetPort: 8080

## apiVersion: apps/v1 kind: Deployment metadata: name: app2 namespace: namespace2 spec: replicas: 1 selector: matchLabels: app: app2 template: metadata: labels: app: app2 spec: containers: - name: app2 image: hashicorp/http-echo args: - “-text=app2” ports: - containerPort: 8080

## KongPlugin YAML - apiVersion: [configuration.konghq.com/v1](http://configuration.konghq.com/v1) kind: KongPlugin metadata: name: luakongredirect namespace: kong config: access: - | local customRouting=require(“customrouting”) customRouting() plugin: pre-function

ConfigMap -  
apiVersion: v1  
kind: ConfigMap  
metadata:  
name: customroutingconfigmap  
namespace: kong  
data:  
customrouting.lua: |  
function redirect()  
if ngx.req.get\_method() == “GET” then  
ngx.var.target = “[http://app1.namespace1.svc.cluster.local:8080](http://app1.namespace1.svc.cluster.local:8080)”  
end  
end

```
    return {
        access = redirect
    }

```

* * *

Kong-ingress-custom-plugin-  
gateway:  
plugins:  
configMaps:

- name: customroutingconfigmap  
pluginName: customroutingconfigmap2

* * *

Ingress Installation-  
helm install kong kong/ingress -n kong --values Kong-ingress-custom-plugin.yaml
