Back to Materialize

Port Forwarding Handling

doc/user/layouts/shortcodes/self-managed/port-forwarding-handling.html

1231.5 KB
Original Source

{{- $console := .Get "console" | default "console" -}} 1. Find your console service name. shell MZ_SVC_CONSOLE=$(kubectl -n materialize-environment get svc \ -o custom-columns="NAME:.metadata.name" --no-headers | grep {{$console}}) echo $MZ_SVC_CONSOLE 1. Port forward the Materialize Console service to your local machine:[^1] shell ( while true; do kubectl port-forward svc/$MZ_SVC_CONSOLE 8080:8080 -n materialize-environment 2\>&1 | tee /dev/stderr | grep -q "portforward.go" && echo "Restarting port forwarding due to an error." || break; done; ) & The command is run in background.

  • To list the background jobs, use jobs.
  • To bring back to foreground, use fg %.
  • To kill the background job, use kill %. 1. Open a browser and navigate to https://localhost:8080 (or, if you have not enabled TLS, http://localhost:8080). The example uses a self-signed ClusterIssuer. As such, you may encounter a warning with regards to the certificate. In production, run with certificates from an official Certificate Authority (CA) rather than self-signed certificates. [^1]: The port forwarding command uses a while loop to handle a known Kubernetes issue 78446, where interrupted long-running requests through a standard port-forward cause the port forward to hang. The command automatically restarts the port forwarding if an error occurs, ensuring a more stable connection. It detects failures by monitoring for "portforward.go" error messages.