Hasura Hub克隆的hello-react应用部署后无法运行求助
Looks like you've hit a classic port mismatch issue here—let's break this down and fix it quickly:
The Root Cause
Your React app's development server is running on its default port (3000, confirmed by the "starting the development server" log message), but your Kubernetes service configuration is pointing to port 8080 via targetPort: 8080. Kubernetes can't route traffic to the correct port, which is why your deployment isn't working as expected.
Step-by-Step Fix
Update the Kubernetes Service Configuration
Open themicroservices/ui/k8s.yamlfile, navigate to theservice.spec.portssection, and change thetargetPortvalue from8080to3000:service: spec: ports: - port: 80 targetPort: 3000 # Modified from 8080 to match React's default port protocol: TCP name: httpReapply the Microservice Config
Run this command to push your updated configuration to Hasura:hasura ms apply -n user uiVerify the Deployment
Check the logs again to confirm the service is running and reachable:hasura ms logs -n user uiOnce you see the React server running message, try accessing your app again—it should load properly now.
Bonus: Custom Port Scenario
If you’ve configured your React app to run on a custom port (for example, by adding PORT=4000 to your package.json start script), make sure to set targetPort to that custom number instead of 3000.
内容的提问来源于stack exchange,提问作者Pushpinder Singh Grewal

