You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the current-context is not set, kube-ps1 will return the following:
132
136
@@ -204,6 +208,23 @@ the following variables:
204
208
|`KUBE_PS1_CTX_COLOR_FUNCTION`| No default, must be user supplied | Function to customize context color based on context name |
205
209
|`KUBE_PS1_HIDE_IF_NOCONTEXT`|`false`| Hide the kube-ps1 prompt if no context is set |
206
210
211
+
For more control over the Kubernetes environment context, you can adjust:
212
+
213
+
| Variable | Default | Meaning |
214
+
| :------- | :-----: | ------- |
215
+
|`KUBE_PS1_ENV_CTX_ENABLE`|`false`| Extract environment identifiers from context and display them as a separate block in square brackets, e.g `testing-mycluster` becomes `[test] mycluster`|
216
+
|`KUBE_PS1_ENV_PADDING`| one space | Padding (spaces or characters) added around the environment block |
217
+
|`KUBE_PS1_ENV_OPEN_SYMBOL`|`[`| Opening symbol used for the environment block |
218
+
|`KUBE_PS1_ENV_CLOSE_SYMBOL`|`]`| Closing symbol used for the environment block |
219
+
|`KUBE_PS1_ENV_PROD_LABEL`|`prod`| Set default production label |
220
+
|`KUBE_PS1_ENV_STG_LABEL`|`stag`| Set default staging label |
221
+
|`KUBE_PS1_ENV_TEST_LABEL`|`test`| Set default testing label |
222
+
|`KUBE_PS1_ENV_DEV_LABEL`|`dev`| Set default developing label |
223
+
|`KUBE_PS1_ENV_PROD_RE`|`(production\|prod)-`| Regex used to detect production in the context name |
224
+
|`KUBE_PS1_ENV_STG_RE`|`(staging\|stg)-`| Regex used to detect staging in the context name |
225
+
|`KUBE_PS1_ENV_TEST_RE`|`(testing\|test)-`| Regex used to detect test in the context name |
226
+
|`KUBE_PS1_ENV_DEV_RE`|`dev(elop(ment)?)?-`| Regex used to detect development in the context name |
227
+
207
228
To disable a feature, set it to an empty string:
208
229
209
230
```sh
@@ -227,6 +248,15 @@ Blue was used for the default symbol to match the Kubernetes color as closely
227
248
as possible. Red was chosen as the context name to stand out, and cyan for the
228
249
namespace.
229
250
251
+
If `KUBE_PS1_ENV_CTX_ENABLE` is set to `true`, you can also modify:
252
+
253
+
| Variable | Default | Meaning |
254
+
| :------- | :-----: | ------- |
255
+
|`KUBE_PS1_ENV_PROD_COLOR`|`red`| Set default color of the production environment |
256
+
|`KUBE_PS1_ENV_STG_COLOR`|`yellow`| Set default color of the staging environment |
257
+
|`KUBE_PS1_ENV_TEST_COLOR`|`green`| Set default color of the testing environment |
258
+
|`KUBE_PS1_ENV_DEV_COLOR`|`blue`| Set default color of the development environment |
259
+
230
260
Set the variable to an empty string if you do not want color for each
0 commit comments