Changed the service to NodePort
apiVersion: v1
kind: Service
metadata:
name: workspace-service
namespace: smt-local
spec:
# type not chosen so ClusterIP
type: NodePort
selector:
app: workspace
ports:
- protocol: TCP
port: 22
# targetport is the internal port where traffic is sent to
# By default and for convenience, the targetPort is set to the same value
# as the port field.
# targetPort: 22
# https://minikube.sigs.k8s.io/docs/handbook/accessing/#getting-the-nodeport-using-kubectl
# minikube service --url workspace-service -n smt-local
nodePort: 30007
and could find it:
kubectl get service workspace-service --output='jsonpath="{.spec.ports[0].nodePort}"'
"30007"%
Then I tried to access the container from my macOS host
minikube ip
192.168.64.21
ssh laradock@192.168.64.21 -p 30007
ssh: connect to host 192.168.64.21 port 30007: Connection refused
I check the Minikube access point using nmap
nmap 192.168.64.21
Starting Nmap 7.91 ( https://nmap.org ) at 2020-12-24 08:28 +07
Nmap scan report for smart48k8.local (192.168.64.21)
Host is up (0.10s latency).
Not shown: 994 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
443/tcp open https
2049/tcp open nfs
8443/tcp open https-alt
and, yes port 22 is listed for which I got password request but the one stored for container Workspace failed. However NodePort 30007 is not listed and did not work. Did do
nmap 192.168.64.21 -p 30007
Starting Nmap 7.91 ( https://nmap.org ) at 2020-12-24 08:33 +07
Nmap scan report for smart48k8.local (192.168.64.21)
Host is up (0.00062s latency).
PORT STATE SERVICE
30007/tcp filtered unknown
Nmap done: 1 IP address (1 host up) scanned in 0.31 seconds
and it states filtered and on “deeper” scan closed:
nmap -sT 192.168.64.21 -p 30007
Starting Nmap 7.91 ( https://nmap.org ) at 2020-12-24 08:35 +07
Nmap scan report for smart48k8.local (192.168.64.21)
Host is up (0.013s latency).
PORT STATE SERVICE
30007/tcp closed unknown
Nmap done: 1 IP address (1 host up) scanned in 0.30 seconds
Is the access issue perhaps because I used minikube addons enable ingress
?
fyi:
kubectl get all -n kube-system
NAME READY STATUS RESTARTS AGE
pod/coredns-74ff55c5b-7lfth 1/1 Running 3 43h
pod/etcd-minikube 1/1 Running 3 43h
pod/ingress-nginx-admission-create-w9rfg 0/1 Completed 0 43h
pod/ingress-nginx-admission-patch-fwr4s 0/1 Completed 2 43h
pod/ingress-nginx-controller-558664778f-gdkps 1/1 Running 4 43h
pod/kube-apiserver-minikube 1/1 Running 3 43h
pod/kube-controller-manager-minikube 1/1 Running 3 43h
pod/kube-proxy-fjc4v 1/1 Running 3 43h
pod/kube-scheduler-minikube 1/1 Running 3 43h
pod/storage-provisioner 1/1 Running 5 43h
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/ingress-nginx-controller-admission ClusterIP 10.109.85.175 <none> 443/TCP 43h
service/kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 43h
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE NODE SELECTOR AGE
daemonset.apps/kube-proxy 1 1 1 1 1 kubernetes.io/os=linux 43h
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/coredns 1/1 1 1 43h
deployment.apps/ingress-nginx-controller 1/1 1 1 43h
NAME DESIRED CURRENT READY AGE
replicaset.apps/coredns-74ff55c5b 1 1 1 43h
replicaset.apps/ingress-nginx-controller-558664778f 1 1 1 43h
NAME COMPLETIONS DURATION AGE
job.batch/ingress-nginx-admission-create 1/1 27s 43h
job.batch/ingress-nginx-admission-patch 1/1 31s 43h