Setting Up TeamCity for Kubernetes
Since version 2020.1, the Kubernetes Support plugin is bundled with TeamCity. The plugin adds the Kubernetes type of cloud profile and allows running build agents in your K8S cluster.
Requirements
TeamCity integration with Kubernetes does not depend on the kubectl
tool and thus does not require installing it in a cluster.
Make sure the TeamCity user is allowed to perform writing operations in the Kubernetes namespace specified in the cloud profile settings.
Kubernetes Cloud Profile Configuration
For general cloud profile options, refer to the Agent Cloud Profile page.
To configure options available for the Kubernetes cloud type, refer to the table below:
Option | Description |
---|---|
Kubernetes API server URL | Specify the URL of the API server. |
Certificate Authority (CA) | Enter the content of the CA certificate for your cluster. |
Kubernetes namespace | Specify a Kubernetes namespace. Leave empty to use the default namespace. |
Authentication strategy | Select the required authentication strategy. Depending on the selected strategy, the set of extra options will vary. Refer to the Kubernetes documentation for details on available options. |
Adding Kubernetes Cloud Image
To run a build agent in Kubernetes, TeamCity needs to create a separate pod in your cluster.
When adding an image to the Kubernetes cloud profile, you can choose one of the three pod specification types:
Use pod template from deployment
Run a new pod based on a deployment created in your cluster.Run single container
Run a single container based on any given agent Docker image.Use custom pod template
Enter your own pod template in a YAML format. This option is recommended for accessing images located in private repositories: you can specify authentication parameters inside the template code.