You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Minikube同节点容器如何访问Spark-Master服务?

Troubleshooting "Master not responsive" when connecting to Spark Master in Kubernetes

Let's work through this issue step by step. First, let's recap your setup from the service description you shared:

minispark@minispark-VirtualBox: kubectl describe svc spark-master
Name: spark-master
Namespace: eniq-dev
Labels:
Annotations:
Selector: component=spark-master
Type: NodePort
IP: 10.97.44.8
Port: webui 8080/TCP
TargetPort: 8080/TCP
NodePort: webui 32396/TCP
Endpoints: 172.18.0.8:8080
Port: spark 7077/TCP
TargetPort: 7077/TCP
NodePort: spark 31599/TCP
Endpoints: 172.18.0.8:7077
Session Affinity: None
External Traffic Policy: Cluster
Events:

Here are the key troubleshooting steps to fix the "Master not responsive" error:

1. Verify Namespace Alignment

Your spark-master service lives in the eniq-dev namespace. If your containerized application is running in a different Kubernetes namespace, you can't reach the service using just spark-master:7077—you need to use the fully qualified domain name (FQDN) instead:

spark.master=spark://spark-master.eniq-dev.svc.cluster.local:7077

If your app is in the same namespace, skip to the next step.

2. Test Connectivity from the Application Container

First, exec into your application's container to test direct connectivity to the Spark Master service:

kubectl exec -it <your-app-pod-name> -n <app-namespace> -- /bin/bash

Then run one of these commands to check if port 7077 is reachable:

# Using telnet
telnet spark-master 7077
# Or using netcat
nc -zv spark-master 7077

If this fails:

  • Check if a NetworkPolicy in either namespace is blocking traffic to port 7077.
  • Confirm the application pod's network can reach the Kubernetes service network (10.97.0.0/16 in your case, since the service IP is 10.97.44.8).

3. Confirm Spark Master is Listening on the Correct Port

Even though the service maps to port 7077, we need to make sure the Spark Master container is actually listening on that port. Exec into the Spark Master pod:

kubectl exec -it <spark-master-pod-name> -n eniq-dev -- /bin/bash

Check active listeners:

# For Debian/Ubuntu-based images
netstat -tulpn | grep 7077
# For Alpine-based images
ss -tulpn | grep 7077

If you don't see a listener on 0.0.0.0:7077 or the container's IP, the Spark Master might be bound to localhost only. Fix this by setting the SPARK_MASTER_HOST environment variable to 0.0.0.0 in your Spark Master deployment, so it listens on all interfaces.

4. Check if Your Application is Outside the Kubernetes Cluster

If your containerized application is not running inside the Minikube/Kubernetes cluster (e.g., it's a standalone container on your Minikube host), you can't use the service name spark-master at all. Instead, you need to use the Minikube IP plus the NodePort for the Spark service (31599 in your case):

spark.master=spark://<minikube-ip>:31599

You can get your Minikube IP with minikube ip.

5. Inspect Spark Master Logs for Errors

Check the Spark Master logs to see if there are any startup issues or connection errors:

kubectl logs <spark-master-pod-name> -n eniq-dev

Look for lines indicating that the master failed to bind to port 7077, or any other errors that might prevent it from accepting connections.


内容的提问来源于stack exchange,提问作者Gururaj Nayak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.09 07:43:11