Create the service as type NodePort with the port:32767 for the nginx pod with the pod selector app:webui
kubectl get pods -l app=webui --show-labels
vi myservice.yaml
apiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
selector:
app: webui
ports:
- port: 80
targetPort: 80
nodePort: 32767
kubectl apply -f myservice.yaml
kubectl get svc
curl k8s-worker1:32767
출처