Add-VSTeamKubernetesEndpoint
SYNOPSIS
Adds connections to Kubernetes clusters
SYNTAX
Add-VSTeamKubernetesEndpoint [-endpointName] <String> -kubeconfig <String> -kubernetesUrl <String>
-clientCertificateData <String> -clientKeyData <String> [-acceptUntrustedCerts] [-generatePfx]
-ProjectName <String> [<CommonParameters>]
DESCRIPTION
The cmdlet adds a new connection between TFS/AzD and a Kubernetes cluster using kubeconfig json.
This is only used when using the Kubernetes tasks.
EXAMPLES
Example 1
$kubeconfig = Get-Content -Path "C:\path\to\kubeconfig.json" -Raw
Add-VSTeamKubernetesEndpoint -Kubeconfig $kubeconfig -KubernetesUrl "https://k8s-cluster.example.com:6443" -EndpointName "MyK8sCluster" -ClientCertificateData "CERTIFICATE_DATA" -ClientKeyData "KEY_DATA" -AcceptUntrustedCerts -GeneratePfx -ProjectName "WebAppProject"
This command creates a new connection to a Kubernetes cluster using the provided kubeconfig file and details. The connection is named "MyK8sCluster" and is associated with the "WebAppProject". It accepts untrusted certificates and generates a pfx file.
Example 2
$kubeconfig = Get-Content -Path "C:\path\to\another\kubeconfig.json" -Raw
Add-VSTeamKubernetesEndpoint -Kubeconfig $kubeconfig -KubernetesUrl "https://another-k8s-cluster.example.org:6443" -EndpointName "AnotherK8sCluster" -ClientCertificateData "ANOTHER_CERTIFICATE_DATA" -ClientKeyData "ANOTHER_KEY_DATA" -ProjectName "BackendServices"
Here, a new Kubernetes connection named "AnotherK8sCluster" is created for the "BackendServices" project using the provided kubeconfig file and details.
Example 3
$kubeconfig = Get-Content -Path "C:\path\to\third\kubeconfig.json" -Raw
Add-VSTeamKubernetesEndpoint -Kubeconfig $kubeconfig -KubernetesUrl "https://third-k8s-cluster.example.net:6443" -EndpointName "ThirdK8sCluster" -ClientCertificateData "THIRD_CERTIFICATE_DATA" -ClientKeyData "THIRD_KEY_DATA" -GeneratePfx -ProjectName "DataAnalytics"
In this example, a connection to a third Kubernetes cluster is created with the name "ThirdK8sCluster" for the "DataAnalytics" project. It uses the provided kubeconfig file and details and generates a pfx file.
Example 4
$kubeconfig = Get-Content -Path "C:\path\to\fourth\kubeconfig.yaml" -Raw
Add-VSTeamKubernetesEndpoint -Kubeconfig $kubeconfig -KubernetesUrl "https://fourth-k8s-cluster.example.io:6443" -EndpointName "FourthK8sCluster" -ClientCertificateData "FOURTH_CERTIFICATE_DATA" -ClientKeyData "FOURTH_KEY_DATA" -AcceptUntrustedCerts -ProjectName "MobileApp"
This command creates a new Kubernetes connection named "FourthK8sCluster" for the "MobileApp" project. It uses the provided kubeconfig file, details, and accepts untrusted certificates.
Example 5
$kubeconfig = Get-Content -Path "C:\path\to\fifth\kubeconfig.yaml" -Raw
Add-VSTeamKubernetesEndpoint -Kubeconfig $kubeconfig -KubernetesUrl "https://fifth-k8s-cluster.example.co:6443" -EndpointName "FifthK8sCluster" -ClientCertificateData "FIFTH_CERTIFICATE_DATA" -ClientKeyData "FIFTH_KEY_DATA" -ProjectName "FrontendUI"
This example demonstrates the creation of a new Kubernetes connection named "FifthK8sCluster" for the "FrontendUI" project using the provided kubeconfig file and details.
PARAMETERS
-ProjectName
Specifies the team project for which this function operates.
You can tab complete from a list of available projects.
You can use Set-VSTeamDefaultProject to set a default project so you do not have to pass the ProjectName with each call.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-acceptUntrustedCerts
Accept untrusted certificates for cluster
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-clientCertificateData
Client certificate from Kubeconfig
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-clientKeyData
Client private key from Kubeconfig
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-endpointName
The name displayed on the services page. In AzD this is the Connection Name.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-generatePfx
Generate pfx file
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-kubeconfig
kubeconfig as JSON string
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
-kubernetesUrl
URL of Kubernetes cluster
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.String
OUTPUTS
System.Object
NOTES
Prerequisites:
Set the account and version that all calls will use with Set-VSTeamAccount. Default version sets to API version 3.0 (TFS2017) if not manually set.
tips:
- check called version of the API with Get-VSTeamAPIVersion or Get-VSTeamInfo
- use Set-VSTeamDefaultProject to set default project for every call
- use Set-VSTeamDefaultAPITimeout to change the default timeout of 60 seconds for all calls.
- use Profiles to load an account and the correct version