Kubernetes
Traducción Beta No Oficial
Esta página fue traducida por PageTurner AI (beta). No está respaldada oficialmente por el proyecto. ¿Encontraste un error? Reportar problema →
Qué hace
Muestra el nombre del contexto activo de Kubernetes y el nombre del espacio de nombres.
Configuración de ejemplo
- json
- yaml
- toml
{
"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"
}
}
}
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
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"
[options.cluster_aliases]
"arn:aws:eks:eu-west-1:1234567890:cluster/posh" = "posh-cluster"
Opciones
| Name | Type | Default | Description |
|---|---|---|---|
display_error | boolean | false | show the error context when failing to retrieve the kubectl information |
parse_kubeconfig | boolean | true | parse kubeconfig files instead of calling out to kubectl to improve performance |
context_aliases | object | custom context namespace | |
cluster_aliases | object | custom cluster name |
Plantilla (info)
plantilla predeterminada
{{ .Context }}{{ if .Namespace }} :: {{ .Namespace }}{{ end }}
Propiedades
| Name | Type | Description |
|---|---|---|
.Context | string | the current kubectl context |
.Namespace | string | the current kubectl context namespace |
.User | string | the current kubectl context user |
.Cluster | string | the current kubectl context cluster |
consejo
Es común que se utilice el espacio de nombres "default" de Kubernetes cuando no se proporciona ningún espacio de nombres. Si quieres que tu prompt muestre un espacio de nombres actual vacío usando la palabra "default", puedes usar algo como esto en la plantilla:
{{.Context}} :: {{if .Namespace}}{{.Namespace}}{{else}}default{{end}}