Skip to content

Instantly share code, notes, and snippets.

@developer-guy
Last active February 1, 2021 10:28
Show Gist options
  • Save developer-guy/f10d3edee8a13640fb0164b6568b0eb4 to your computer and use it in GitHub Desktop.
Save developer-guy/f10d3edee8a13640fb0164b6568b0eb4 to your computer and use it in GitHub Desktop.
Display Kubernetes OpenAPI Spec
#!/usr/bin/env bash
set -e
# Proxy minikube to localhost on arbitrary port:
kubectl proxy --port=8080 &
sleep 3
# Now swagger.json is available at localhost:12345/openapi/v2
# Save to /tmp/temp/json and serve with e.g. docker swagger-ui container
curl http://localhost:8080/openapi/v2 > /tmp/temp.json
docker container run -d -p 9999:8080 -e SWAGGER_JSON=/var/specs/temp.json -v /tmp/temp.json:/var/specs/temp.json swaggerapi/swagger-ui
sleep 3
# Open browser to localhost:9999
open http://localhost:9999
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment