I am trying to deploy a pod in kubernetes and link a service to it so I can access it via web browser.
The pod specification is the following:
apiVersion: apps/v1
kind: Deployment
metadata:
name: visualizer-nautic
labels:
app: visualizer
spec:
replicas: 1
selector:
matchLabels:
app: visualizer
template:
metadata:
annotations:
k8s.v1.cni.cncf.io/networks: zenoh-network
labels:
app: visualizer
spec:
containers:
- name: api
image: hielito/visualizer:latest
ports:
- containerPort: 8100
It deploys a web app, its frontend is exposed at port 8100, so then I add a NodePort service to make it visible in my network:
apiVersion: v1
kind: Service
metadata:
name: visualizer-service
spec:
type: NodePort
selector:
app: visualizer
ports:
- port: 8100
targetPort: 8100
nodePort: 30012
Once I have this service deployed, I try to access localhost:30012, but the web browser just gets stuck at loading and eventually throw a timeout error.
If anyone is wondering, the app deployed is working fine, if I execute a port-forward (microk8s kubectl port-forward pods/visualizer-nautic-77957b94c9-mww6p 8100:8100
) I can then access the app working perfectly at localhost:8100.
EDIT: I forgot to add that I am using multus CNI add-on and have a MACVLAN network interface added to the pod. When I remove the additional CNI it works fine again, so the MACVLAN network might be interfering with the service.
EDIT2: As requested, I leave specs and versions here:
OS - Ubuntu 20.04 LTS
Kubernetes - Microk8s 1.23