I'm running my Kubernetes Cluster using Docker and not using Minikube Cluster (requires a lot of memory) however after applying the required files, I can't get an external URL (like I used to have when I used Minikube) to run it in my Chrome browser.
Consider the followings:
The Pod:
apiVersion: v1
kind: Pod
metadata:
name: webapp-release-0-5
labels:
app: webapp
release: "0-5"
spec:
containers:
- name: webapp
image: richardchesterwood/k8s-fleetman-webapp-angular:release0-5
And its Service :
apiVersion: v1
kind: Service
metadata:
name: fleetman-webapp
spec:
# This defines which pods are going to be represented by this Service
# The service becomes a network endpoint for either other services
# or maybe external users to connect to (eg browser)
selector:
app: webapp
release: "0-5"
ports:
- name: http
port: 80
nodePort: 30080
type: NodePort
After applying both from Command line (WINDOWS 10 CLI) :
>>> kubectl get services
fleetman-webapp NodePort 10.96.227.189 <none> 80:30080/TCP 5m57s
>>> kubectl get po
webapp 1/1 Running 0 12m
webapp-release-0-5 1/1 Running 0 12m
However, I don't have an external URL of this POD to put in my browser to check out the App, like I used to have in Minikube.
How can we generate such URL?
It's particularly hard to make it work in a bespoke way. I would suggest to use kind which creates kubernetes nodes as docker container. You can access NodePort service via http://<NODEIP>:<NODEPORT>
. To get NODEIP
use kubectl get nodes