Moodio's DigitalOcean Kubernetes tasks
Overview
Moodio's DigitalOcean Kubernetes Tasks is a collection (currently just 1) of tasks for more easily using the Kubernetes service from DigitalOcean with Azure Devops.
Config Retriever Task
The config retriever task is a task used to get the config.yaml file required to connect to a DigitalOcean Kubernetes cluster to be used in tasks further down the chain.
The task can store the config.yaml in either a variable, or as a file in the working directory.
How to use
To use the task:
- Login to DigitalOcean and create a personal access token. For details visit the guide on the DigitalOcean website
- Add the task to your Digital Ocean Kubernetes Config Retriever to your pipeline.
- Enter the Personal Access Token into the input field labelled Personal Access Token
- Enter the name of the cluster as it appears in your DigitalOcean dashboard into the field labled Cluster name
- Choose where to save the config. Please note saving to a variable is currently in beta and may or may not work for you. So you're better off picking a path instead.
- Your done. Now simply point any tasks that require the config.yaml file to the directory you have chosen, the filename will be stored as {path}/config.yaml. For example, if you are using it in the Kubernetes task, add the argument --kube-config {path}/config.yaml
Using with YAML based build definitions
To use in a yaml based build definition, use the following definition, replacing in your own values and modify to your own needs. The below example however illustrates its usage for applying a YAML configuration file.
inputs:
pat: '<PersonalAccessToken>'
clusterName: '<KubernetesClusterName>'
configOutput: file
outputFilePath: $(Build.Repository.LocalPath)
displayName: retrive access token
To then use the configuration file within the Azure DevOps Kubernetes task, using the example of applying a YAML definition, use the below definition, replacing in your own values. For other commands type, modify as you see fit.
inputs:
connectionType: 'None'
command: 'apply'
useConfigurationFile: true
configuration: '$(Build.Repository.LocalPath)/$(projectDirectory)/k8s-deployment.yaml'
arguments: '--kubeconfig $(Build.Repository.LocalPath)/config.yaml'
secretType: 'dockerRegistry'
containerRegistryType: 'Azure Container Registry'
If you have any comments, feedbacks or requests, please feel free to raise an issue in the github repository.