[ad_1]
I start minikube
with:
minikube start --driver=docker
I have a simple Node.js app:
import express from "express";
import os from "os";
const app = express();
const PORT = 3000;
app.get("/", (req, res) => {
const helloMessage = `Hello from the ${os.hostname()}`;
console.log(helloMessage);
res.send(helloMessage);
});
app.listen(PORT, () => {
console.log(`Web server is listening on port ${PORT}`);
});
I create a deployment with NodePort
type:
kubectl expose deployment k8s-web-hello --type=NodePort --port=3000
kubectl get svc
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
k8s-web-hello NodePort 10.96.41.105 <none> 3000:30734/TCP 10m
kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 9h
minikue ip
192.168.49.2
If I use minikube ssh
, I can curl 192.168.49.2:30734
or curl 10.96.41.105:3000
and get the expected output.
However, if I use:
minikube service k8s-web-hello
🏃 Starting tunnel for service k8s-web-hello.
🎉 Opening service default/k8s-web-hello in default browser...
❗ Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
It opens a new tab on my web browser (Chrome) but it cannot load: http://192.168.49.2:30734/
.
I have tried suggested solutions in #11193 including:
minikube service k8s-web-hello --url
🏃 Starting tunnel for service k8s-web-hello.
❗ Because you are using a Docker driver on darwin, the terminal needs to be open to run it.
minikube version
minikube version: v1.25.2
commit: 362d5fdc0a3dbee389b3d3f1034e8023e72bd3a7
kubectl version
Client Version: version.Info{Major:"1", Minor:"24", GitVersion:"v1.24.1", GitCommit:"3ddd0f45aa91e2f30c70734b175631bec5b5825a"
Mac OS
12.4 (21F79)
M1 chip
Google Chrome
Chrome is up to date
Version 102.0.5005.61 (Official Build) (arm64)
Docker Desktop for MacOS
Version
4.8.2 (79419)
[ad_2]