Skip to content

Commit

Permalink
k8s-config: Add support for NodePort service type
Browse files Browse the repository at this point in the history
Right now the KBS service is only exposed as the
ClusterIP service type. And to be able to really
use the KBS service you need to expose it using an
Ingress, but this is not always feasible. So this
commit adds a way for the KBS service to be
exposed as a NodePort service type.

Signed-off-by: Suraj Deshmukh <[email protected]>
  • Loading branch information
surajssd committed Apr 17, 2024
1 parent ee1a8ce commit 10723cb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
18 changes: 18 additions & 0 deletions kbs/config/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,24 @@ kustomize edit add resource ingress.yaml
popd
```

## Optional: Expose KBS using Nodeport

If you would like to expose KBS service using Nodeport then add the following snippet to the `overlays/kustomization.yaml` file in the `patches:` section:

```yaml
- path: patch-service-nodeport.yaml
target:
group: ""
kind: Service
name: kbs
```
Now you can use the services' nodeport and the Kubernetes node's IP to reach out to the KBS. You can generate the KBS URL by running the following command:
```bash
echo $(kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}'):$(kubectl get svc kbs -n coco-tenant -o jsonpath='{.spec.ports[0].nodePort}')
```

## Deploy KBS

Deploy KBS by running the following command:
Expand Down
3 changes: 3 additions & 0 deletions kbs/config/kubernetes/overlays/patch-service-nodeport.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- op: add
path: /spec/type
value: NodePort

0 comments on commit 10723cb

Please sign in to comment.