View and change the kubernetes configuration context
Version : 1.0
File Name : kubecontext.ps1
Author : Adewale Azeez - iamthecarisma@gmail.com
Date : March-27-2020
This command list all the context in the current kubernetes and also switch the context also if an extra parameter is specified.
Adding the switch -All without any other parameter shows the all the context in the configuration.
The -User switch display the first user and the -Users list all the users. The switch -User and -Users should not be combined.
kubecontext [[-ContextName] <String>] [-All] [-User] [-Users]
[<CommonParameters>]
the name of the context to switch to
attr |
value |
---|---|
Required? |
false |
Position? |
1 |
Default value |
|
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
view all the context in the configuration
attr |
value |
---|---|
Required? |
false |
Position? |
named |
Default value |
False |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
display the first user
attr |
value |
---|---|
Required? |
false |
Position? |
named |
Default value |
False |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
list all the users
attr |
value |
---|---|
Required? |
false |
Position? |
named |
Default value |
False |
Accept pipeline input? |
false |
Accept wildcard characters? |
false |
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
System.String
kubecontext
View the current context
kubecontext -All
List all the context in the configuration
kubecontext test
Switch your kubernetes context to ‘test’
kubecontext prod
Switch your kubernetes context to ‘prod’