We will use my Crudservice: https://github.com/wlanboy/CrudService
It is published on Docker Hub: https://hub.docker.com/repository/docker/wlanboy/crudservice
cd ~
git clone https://github.com/wlanboy/CrudService.git
kubectl cluster-info
kubectl get pods --all-namespaces
cd ~/CrudService
kubectl create namespace crud
kubectl apply -f crudservice-deployment.yaml
kubectl apply -f crudservice-service.yaml
kubectl get pods -n crud -o wide
kubectl describe deployments -n crud crudservice
kubectl describe services -n crud crudservice-service
kubectl expose deployment -n crud crudservice --type=NodePort --name=crudservice-serviceexternal --port 8002
kubectl describe services -n crud crudservice-serviceexternal
Result:
Name: crudservice-serviceexternal
Namespace: crud
Labels: app=crudservice
Annotations: <none>
Selector: app=crudservice
Type: NodePort
IP Family Policy: SingleStack
IP Families: IPv4
IP: 10.108.40.138
IPs: 10.108.40.138
Port: <unset> 8002/TCP
TargetPort: 8002/TCP
NodePort: <unset> 30411/TCP <--- THIS IS THE PORT WE NEED
Endpoints: 10.10.0.6:8002
Session Affinity: None
External Traffic Policy: Cluster
Events: <none>
- curl http://192.168.56.100:30411/actuator/health
- Result
{"status":"UP","groups":["liveness","readiness"]}