Last active
July 5, 2022 07:56
-
-
Save linktohack/b3fafbce53eabed611e97d3d64366025 to your computer and use it in GitHub Desktop.
KUBERNETES List all ingress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k get ingress -A --output json | jq ' | |
def pad(n): tostring | if length >= n then . else ([range(n-length) | "0"] | join("")) + . end; | |
.items | |
| sort_by(.metadata.namespace) | |
| map({ ns: .metadata.namespace, name: .spec.rules[].http.paths[].backend.service.name, host: .spec.rules[].host, path: .spec.rules[].http.paths[].path }) | |
| to_entries | |
| map({ name: [.value.ns, .value.name, .key | pad(2)] | join("-"), url: ["https://", .value.host, .value.path] | join("") }) | |
| map(select(.url | contains("*") | not)) | |
| unique_by(.url) | |
| sort_by(.name) | |
' | yq -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k get ing -A -o json | jq '[ .items[] | { | |
namespace: .metadata.namespace, | |
host: .spec.rules[].host, | |
path: .spec.rules[].http.paths[].path, | |
service: .spec.rules[].http.paths[].backend.service.name | |
} ] | group_by(.namespace)' | yq -y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment