Kubernetes extension

This extension is now unpublished from Marketplace. You can choose to uninstall it.

Kubernetes extension for VSTS

Enable us to use Kubernetes related product for VSTS. Also it enable us to kubernetes endpoint for kubectl. You can use kubectl, helm, and istioctl by this extension. This task aims for using Linux Hosted Agent(preview). GitHub repo is here.

NOTE: this task is NOT the official Kubernetes task created by Microsoft.

Currently you can use istio/helm feature from 3.0.0. or later.

1. How to use

1.1. Create an endopint

Choose Kubernetes endpoint

Choose Kubernetes endpoint.

Set your endpoint

Kubernetes Connection pops up. Then fill the box.

Connection name: Endpoint name (Anything is OK)

Server URL : K8s Cluster URL for memo (Not used for the task until now)

If you copy config file into Kubeconfig, the build log of VSTS might show you the contents.
This happens when you copy multiline.
Kubernetes tasks support base64 encoding for Kubeconfig column. If you want to avoid this problem,
you can convert your config file into base64 string. You can find the tool for converting config file. tools/convert.ts

Usage

your config file should be LF not CRLF if you want to use on Linux hosted build.

tsc -p .
node tools/convert.js {filename}

You can find {filename}_new file which include base64 encoding string.

1.2. downloader

If you want to use kubectl/istioctl/helm binary, you need to use this task in advance. For the backword compatibility, I letf the old tasks like kubernetes apply task and kubernetes general task. However, I recommend to use the new task with downloader. It will be much more flexible and simple.

If you use this downlaoder, you can avoid to download the binary several times. This task download kubectl/istioctl/helm binary into ./.vstsbin directory and add it to the PATH environment variables. Also, it set KUBECONFIG environment variables. If you use this downloader, the following task can use kubectl/istioctl/helm command without specifying the full-path binary file name.

Display Name: Name of the task

k8s endpoint: select the endpoint which you created at 1.1. Create an endopint

1.6. kubernetes apply task

If you use ver 2.0, you don't need this operation. However, this operation could fasten your pipeline without downloading a kubectl binary.

Link your repo which has kubecntl command.

Please chmod +x kubectl before adding kubectl to your repo.

1.6.2. Setup your kubectlapply task

Then you can use the endpoint, specify the kubectl command and YAML file
for deployment. Internally, it calls kubectl apply command.

If you want to change the YAML file dynamically, you can use Replace tokens on the VSTS Marketplace.

You can see the downloadVersion textbox. If you don't specify KubectlBinary, this task automatically download the latest
kubebinary. If you want to specify the version, fill the downloadVersion, e.g. v1.5.2.

1.7. kubernetes general task

NOTE: kubernetes apply/general task is for backward compatibility.

You can use every kubectl command you want. Use kubectlgeneral task.
You can specify a lot of arguments separated with space or new line.

You can see the downloadVersion textbox. If you don't specify KubectlBinary, this task automatically download the latest
kubebinary. If you want to specify the version, fill the downloadVersion, e.g. v1.5.2.