My environment: Windows 10 + WSL2 + Docker Desktop (k8s v1.19.7)
I have created a small sample application. It returns 'it works' on [ip:80]/Converter
I have packaged the app in a container. And when I run it like this:
docker run -d -p 80:80 [imagename]
It returns 'it works' on [ip:80]/Converter
Then I defined a deployment.yaml
:
apiVersion: apps/v1
kind: Deployment
metadata:
name: escape
namespace: default
spec:
replicas: 3
selector:
matchLabels:
bb: escape
template:
metadata:
labels:
bb: escape
spec:
containers:
- name: escape
image: [imagename]
ports:
- containerPort: 80
protocol: TCP
This gives me 3 pods with my container running.
Then I create a service for my deployment:
kubectl expose deployment escape --type=LoadBalancer --name=escape-service
listing the services: kubectl get services
escape-service LoadBalancer 10.105.198.65 localhost 80:32496/TCP 17m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 25m
This exposes the service but I cannot reach it on: http://localhost:32496/converter
So how do I reach my service outside my Kubernetes cluster?
What have I tried: Googling led me to: Docker Desktop + k8s plus https proxy multiple external ports to pods on http in deployment? But as that is running on Hyper-V it different I guess
I installed Lens (https://k8slens.dev/)
This gives an overview of the services:
Clicking on the 80:32496/TCP
link open browser to http://localhost:59394
When I manually postfix this to
http://localhost:59394/Converter
I get the "It works" response.
How does the converting of ports work on Docker Desktop for Windows + WSL2? And how can I find the port 59394
without resorting to Lens?
Also when I try to list ingress it seems I don't have any kubectl describe ingress
Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
No resources found in default namespace.