Direct naar hoofdinhoud

Kubernetes

Onofficiรซle Beta-vertaling

Deze pagina is vertaald door PageTurner AI (beta). Niet officieel goedgekeurd door het project. Een fout gevonden? Probleem melden โ†’

Watโ€‹

Toont de naam van de huidige actieve Kubernetes-context en namespace

Voorbeeldconfiguratieโ€‹

{
"type": "kubectl",
"style": "powerline",
"powerline_symbol": "๎‚ฐ",
"foreground": "#000000",
"background": "#ebcc34",
"template": " ๓ฑƒพ {{.Context}}{{if .Namespace}} :: {{.Namespace}}{{end}} ",
"options": {
"context_aliases": {
"arn:aws:eks:eu-west-1:1234567890:cluster/posh": "posh"
},
"cluster_aliases": {
"arn:aws:eks:eu-west-1:1234567890:cluster/posh": "posh-cluster"
}
}
}

Optiesโ€‹

NameTypeDefaultDescription
display_errorbooleanfalseshow the error context when failing to retrieve the kubectl information
parse_kubeconfigbooleantrueparse kubeconfig files instead of calling out to kubectl to improve performance
context_aliasesobjectcustom context namespace
cluster_aliasesobjectcustom cluster name

Template (informatie)โ€‹

standaard sjabloon
{{ .Context }}{{ if .Namespace }} :: {{ .Namespace }}{{ end }}

Eigenschappenโ€‹

NameTypeDescription
.Contextstringthe current kubectl context
.Namespacestringthe current kubectl context namespace
.Userstringthe current kubectl context user
.Clusterstringthe current kubectl context cluster
tip

Het is gebruikelijk dat de Kubernetes "default"-namespace wordt gebruikt wanneer geen namespace is opgegeven. Als je wilt dat je prompt een lege huidige namespace weergeeft met het woord "default", kun je zoiets als dit gebruiken voor het sjabloon:

{{.Context}} :: {{if .Namespace}}{{.Namespace}}{{else}}default{{end}}