TeamCity Operator is a Kubernetes operator that deploys and manages TeamCity servers using a Custom Resource Definition (CRD).
- Helm chart: charts/teamcity-operator
- CRD group/version: jetbrains.com/v1beta1, kind: TeamCity
- Sample manifests:
config/samples/v1beta1(see alsoconfig/samples/teamcity_full.yaml) - Annotations reference: see Annotations below
- Development guide: docs/DEVELOPMENT.md
- Upgrade policy: docs/UPGRADE-POLICY.md
- Security policy and vulnerability reporting: SECURITY.md
- Common questions: see FAQ below
- Kubernetes v1.26.0+
- cert-manager installed in the cluster
- Tested with cert-manager v1.14.3
- Install example:
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.14.3/cert-manager.yaml
Install release 0.0.21 of the chart from GitHub Releases:
helm upgrade --install teamcity-operator \
-n teamcity-operator --create-namespace \
https://github.com/JetBrains/teamcity-operator/releases/download/0.0.21/teamcity-operator-0.0.21.tgzFrom the repository root of this project:
helm upgrade --install teamcity-operator \
-n teamcity-operator --create-namespace \
./charts/teamcity-operatorVerify installation:
kubectl get pods -n teamcity-operator
kubectl get crd teamcities.jetbrains.comAfter installing the operator, apply a TeamCity custom resource. Below are common configurations.
Each manifest under config/samples/v1beta1/ includes a header comment with an kubectl apply command. For a combined reference manifest, see config/samples/teamcity_full.yaml.
| Sample | Purpose |
|---|---|
_v1beta1_teamcity.yaml |
Minimal single-node |
_v1beta1_teamcity_with_database.yaml |
External database (bundled demo MySQL) |
_v1beta1_teamcity_with_startup_properties.yaml |
Startup properties ConfigMap |
_v1beta1_teamcity_with_ingress.yaml |
Headless Service + Ingress |
_v1beta1_teamcity_with_serviceaccount.yaml |
Dedicated ServiceAccount |
_v1beta1_teamcity_with_init_containers.yaml |
Custom init containers |
_v1beta1_teamcity_with_stop_wait_time.yaml |
Graceful stop wait time (spec.stopWaitTimeSeconds) |
_v1beta1_teamcity_with_node_selector.yaml |
Node selector |
_v1beta1_teamcity_with_affinity.yaml |
Pod affinity |
_v1beta1_teamcity_with_service.yaml |
Headless Service + serviceName (new deployment) |
_v1beta1_teamcity_with_service_name_recreate.yaml |
serviceName change on existing deployment |
_v1beta1_teamcity_with_secondary_node.yaml |
Multi-node with responsibilities |
_v1beta1_teamcity_with_node_data_dir.yaml |
Per-node data directory (*.spec.nodeDataDirVolumeClaim) |
_v1beta1_teamcity_with_node_data_dir_adopt.yaml |
Adopt existing PVC via existingClaim: true |
_v1beta1_teamcity_with_custom_mounts.yaml |
ConfigMap/Secret volumes (spec.volumes, nodeSpec.volumes) and per-node PVCs |
_v1beta1_teamcity_with_node_volume_claims_adopt.yaml |
Adopt an existing per-node PVC via existingClaim: true |
_v1beta1_teamcity_with_secondary_node_read_only.yaml |
Secondary node without responsibilities |
_v1beta1_teamcity_with_zero_downtime_upgrade.yaml |
Zero-downtime upgrade (single node) |
_v1beta1_teamcity_with_secondary_node_with_zero_downtime_upgrade.yaml |
Zero-downtime upgrade (multi-node) |
Note: When setting CPU and memory requests/limits for nodes, consult the official TeamCity Server Requirements to estimate appropriate resources: https://www.jetbrains.com/help/teamcity/system-requirements.html#TeamCity+Server+Requirements.
apiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
mainNode:
name: main-node
spec:
requests:
cpu: "900m"
memory: "1512Mi"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1GiapiVersion: v1
data:
connectionProperties.password: DB_PASSWORD
connectionProperties.user: DB_USER
connectionUrl: DB_CONNECTION_STRING # format jdbc:mysql://DB_HOST:DB_PORT/SCHEMA_NAME
kind: Secret
metadata:
name: database-properties
---
apiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-with-database
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
databaseSecret:
secret: database-properties
mainNode:
name: main-node
spec:
env:
- name: AWS_DEFAULT_REGION
value: "eu-west-1"
- name: AWS_ACCESS_KEY_ID
valueFrom:
secretKeyRef:
name: aws-credentials
key: access-key-id
requests:
cpu: "900m"
memory: "1512Mi"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1GiapiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-with-startup-properties
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
startupPropertiesConfig:
teamcity.startup.maintenance: "false"
teamcity.firstStart.setupAdmin.enabled: "false"
mainNode:
name: main-node
spec:
requests:
cpu: "900m"
memory: "1512Mi"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1GiapiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-sample-with-ingress
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
mainNode:
name: main-node
spec:
requests:
cpu: "900m"
memory: "1512Mi"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
serviceList:
- name: tc-sample-for-ingress
spec:
selector:
app.kubernetes.io/name: teamcity-sample-with-ingress
app.kubernetes.io/component: teamcity-server
app.kubernetes.io/part-of: teamcity
ports:
- protocol: TCP
port: 8111
targetPort: 8111
clusterIP: None
ingressList:
- name: tc-ingress
annotations:
nginx.ingress.kubernetes.io/proxy-read-timeout: "3600"
nginx.ingress.kubernetes.io/proxy-send-timeout: "3600"
nginx.ingress.kubernetes.io/server-snippets: |
location / {
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade; # WebSocket support
proxy_set_header Connection "upgrade"; # WebSocket support
}
spec:
ingressClassName: nginx
rules:
- host: teamcity.mycompany.com
http:
paths:
- backend:
service:
name: tc-sample-for-ingress
port:
number: 8111
pathType: ImplementationSpecificThe Ingress backend service.name must match a name from spec.serviceList. Service selectors must use app.kubernetes.io/component: teamcity-server — that is the label the operator sets on TeamCity pods.
apiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-with-service-account
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
serviceAccount:
name: teamcity-service-account
annotations:
eks.amazonaws.com/role-arn: AWS_ROLE
mainNode:
name: node
spec:
requests:
cpu: "900m"
memory: "1512Mi"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1GiapiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-init-containers
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
mainNode:
name: main-node
spec:
initContainers:
- name: init-myservice
image: busybox:1.28
command: [ 'sh', '-c', "echo Hello" ]
requests:
cpu: "900m"
memory: "1512Mi"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gispec.stopWaitTimeSeconds (default 60, between 1 and 86400) is how long a node gets to stop gracefully before the JVM is killed. The operator passes it to every node as TEAMCITY_STOP_WAIT_TIME and sets the pod terminationGracePeriodSeconds 30 seconds above it, so Kubernetes does not kill the pod mid-stop.
spec:
stopWaitTimeSeconds: 120 # terminationGracePeriodSeconds becomes 150Full sample: config/samples/v1beta1/_v1beta1_teamcity_with_stop_wait_time.yaml.
Upgrade note: operator versions that introduce this field also drop the preStop hook from the server container and set terminationGracePeriodSeconds (previously the Kubernetes default of 30). The pod template of every node changes, so upgrading the operator restarts all nodes (through the zero-downtime flow when the update-policy annotation enables it). If you set TEAMCITY_STOP_WAIT_TIME in a node's env, move the value to spec.stopWaitTimeSeconds: the field overrides it, and the webhook warns about it.
Multi-node setups require a shared database. Provide spec.databaseSecret pointing at a Secret with JDBC settings (see the database example above). The read-only sample references an external Secret; see config/samples/v1beta1/_v1beta1_teamcity_with_secondary_node_read_only.yaml.
apiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-sample-with-secondary-node-read-only
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
databaseSecret:
secret: database-properties
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
mainNode:
name: main-node
spec:
requests:
cpu: "900m"
memory: "1512Mi"
secondaryNodes:
- name: secondary-node
spec:
requests:
cpu: "900m"
memory: "1512Mi"When no node sets responsibilities, the operator accepts the configuration as-is. Once any node specifies responsibilities, validation rules apply (see below).
See TeamCity multi-node responsibilities: https://www.jetbrains.com/help/teamcity/multinode-setup.html#Responsibilities
When responsibilities are configured, the main node must include at least MAIN_NODE and CAN_PROCESS_USER_DATA_MODIFICATION_REQUESTS. Secondary nodes must not include MAIN_NODE. All five responsibilities should be distributed across the cluster without duplication:
MAIN_NODECAN_PROCESS_BUILD_MESSAGESCAN_CHECK_FOR_CHANGESCAN_PROCESS_BUILD_TRIGGERSCAN_PROCESS_USER_DATA_MODIFICATION_REQUESTS
apiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-sample-with-secondary-node
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
spec:
image: jetbrains/teamcity-server
startupPropertiesConfig:
teamcity.startup.maintenance: "false"
teamcity.firstStart.setupAdmin.enabled: "false"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
mainNode:
name: main-node
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "true"
spec:
requests:
cpu: "900m"
memory: "1512Mi"
responsibilities: [ "MAIN_NODE", "CAN_PROCESS_USER_DATA_MODIFICATION_REQUESTS" ]
secondaryNodes:
- name: secondary-node
annotations:
cluster-autoscaler.kubernetes.io/safe-to-evict: "false"
spec:
requests:
cpu: "900m"
memory: "1512Mi"
responsibilities: [ "CAN_PROCESS_BUILD_MESSAGES", "CAN_CHECK_FOR_CHANGES", "CAN_PROCESS_BUILD_TRIGGERS" ]TeamCity can keep node-specific caches on a separate volume via -Dteamcity.node.data.path. Set optional spec.mainNode.spec.nodeDataDirVolumeClaim / spec.secondaryNodes[].spec.nodeDataDirVolumeClaim. Whenever nodeDataDirVolumeClaim is present, the operator mounts it and sets -Dteamcity.node.data.path=<mountPath>.
Volume mount name and path must be the same on every node that enables the feature.
Greenfield — omit existingClaim; provide spec so the operator creates/manages the PVC:
nodeDataDirVolumeClaim:
name: node-data-dir-main-node
volumeMount:
name: node-data-dir
mountPath: /mnt/node-data-dir
spec:
accessModes: [ReadWriteOnce]
storageClassName: gp3
resources:
requests:
storage: 2000GiImport existing (Nightly / Helm) — set existingClaim: true; spec is optional. Operator mounts name and does not create or take ownership:
nodeDataDirVolumeClaim:
name: node-data-dir-tc-project-teamcity-secondary-0
existingClaim: true
volumeMount:
name: node-data-dir
mountPath: /mnt/node-data-dirNightly claim name patterns (tc-project release):
| Node | Pattern | Example |
|---|---|---|
| Main | {fullname}-main-node-data-dir |
tc-project-teamcity-main-node-data-dir |
| Secondary | node-data-dir-{fullname}-secondary-{ordinal} |
node-data-dir-tc-project-teamcity-secondary-0 |
Upgrading the operator alone does nothing until a TeamCity CR sets per-node nodeDataDirVolumeClaim. Enabling the field updates the pod template (rolling restart); allow-sts-recreate is not required.
During experimental zero-downtime upgrades, the temporary read-only replica uses an emptyDir at the same path (RWO cannot attach to two pods).
Full sample: config/samples/v1beta1/_v1beta1_teamcity_with_node_data_dir.yaml.
volumes[] accepts any Kubernetes volume source — ConfigMap, Secret, CSI, emptyDir, a PVC you created yourself — and mounts it into the TeamCity container. Each entry is a standard pod volume plus one extra field, mount, which supplies the volumeMount for the TeamCity container. Omit mount to define the volume without mounting it, which is useful when only an init container needs it.
Declare the volume at the level that matches its scope:
| Field | Applies to |
|---|---|
spec.volumes[] |
every node |
spec.mainNode.spec.volumes[] |
the main node only |
spec.secondaryNodes[].spec.volumes[] |
that secondary node only |
This mirrors dataDirVolumeClaim / nodeDataDirVolumeClaim: spec level means shared, node level means that node alone.
spec:
volumes:
- name: database-secret
csi:
driver: secrets-store.csi.k8s.io
readOnly: true
volumeAttributes:
secretProviderClass: teamcity-database
mount:
mountPath: /mnt/database
readOnly: true
- name: git-key
secret:
secretName: git-key
secondaryNodes:
- name: secondary-node
spec:
volumes:
- name: nodeconfig
configMap:
name: teamcity-node-config
mount:
mountPath: /mnt/nodeconfigAbove, database-secret is mounted on every node, git-key is available to init containers only, and nodeconfig exists on secondary-node alone. Init containers declared in spec.*.spec.initContainers reference these volumes by name in their own volumeMounts.
Because two nodes never share a pod, they may reuse the same volume name and mount path while pointing at different objects. This is how you give each node its own configuration or credentials:
mainNode:
name: main-node
spec:
volumes:
- name: nodeconfig
configMap:
name: tc-config-main
mount:
mountPath: /mnt/nodeconfig
secondaryNodes:
- name: secondary-node
spec:
volumes:
- name: nodeconfig
configMap:
name: tc-config-secondary
mount:
mountPath: /mnt/nodeconfigA node receives spec.volumes[] plus its own spec.volumes[]. Within that merged set, names and mount paths must be unique, and must not collide with the data directory, spec.persistentVolumeClaims[], or any per-node claim. hostPath sources are accepted but produce an admission warning, since their contents are tied to the Kubernetes node the pod lands on.
spec.persistentVolumeClaims[] mounts the same PVC on every node, which only works for ReadWriteMany storage. When each node needs its own volume — a ReadWriteOnce git cache, for example — use spec.mainNode.spec.persistentVolumeClaims[] and spec.secondaryNodes[].spec.persistentVolumeClaims[] instead. Each node names its own claim, so nodes may differ in storage class and size while sharing a mount path:
mainNode:
name: main-node
spec:
persistentVolumeClaims:
- name: git-cache-main-node
volumeMount:
name: git-cache
mountPath: /mnt/git-cache
spec:
accessModes: [ReadWriteOnce]
storageClassName: gp3
resources:
requests:
storage: 20GiThese behave like nodeDataDirVolumeClaim, minus the -Dteamcity.node.data.path property. Omit existingClaim and provide spec, as above, to have the operator create and own the claim. To mount a volume that already exists — migrating from Helm, for example — set existingClaim: true and drop spec; the operator mounts the named PVC without creating it or taking ownership:
persistentVolumeClaims:
- name: existing-git-cache
existingClaim: true
volumeMount:
name: git-cache
mountPath: /mnt/git-cachePer-node claims are labelled teamcity.jetbrains.com/node-pvc and are never deleted by the operator, so removing a node or a claim from the spec detaches the volume but leaves the data in place; delete such PVCs manually when you no longer need them. During experimental zero-downtime upgrades the read-only replica substitutes an emptyDir at the same path.
Samples: config/samples/v1beta1/_v1beta1_teamcity_with_custom_mounts.yaml and config/samples/v1beta1/_v1beta1_teamcity_with_node_volume_claims_adopt.yaml.
Set spec.serviceList with clusterIP: None and reference the service from each node via spec.mainNode.spec.serviceName (and/or spec.secondaryNodes[].spec.serviceName). This gives each StatefulSet pod a stable DNS name under the headless service.
For a new TeamCity created with serviceName already in the spec, no extra annotation is required. See config/samples/v1beta1/_v1beta1_teamcity_with_service.yaml.
serviceList:
- name: tc-sample-one-svc
spec:
selector:
app.kubernetes.io/name: teamcity-sample-with-svc
app.kubernetes.io/component: teamcity-server
app.kubernetes.io/part-of: teamcity
ports:
- protocol: TCP
port: 8111
targetPort: 8111
clusterIP: None
mainNode:
name: node
spec:
serviceName: tc-sample-one-svc
requests:
cpu: "400m"
memory: "1000Mi"
secondaryNodes:
- name: secondary-node
spec:
serviceName: tc-sample-one-svc
requests:
cpu: "400m"
memory: "1000Mi"Kubernetes treats StatefulSet.spec.serviceName as immutable. If you add or change serviceName on a TeamCity whose StatefulSets were already created without it, set the allow-sts-recreate annotation before applying the change.
Workflow:
kubectl annotate teamcity <name> teamcity.jetbrains.com/allow-sts-recreate=true- Patch or edit the TeamCity and set
spec.mainNode.spec.serviceName(and/or secondary nodeserviceName) - The operator recreates the affected StatefulSet(s) and restarts the node(s)
Without the annotation, the webhook rejects the change and the controller reports the conflict in status and events. See config/samples/v1beta1/_v1beta1_teamcity_with_service_name_recreate.yaml.
Note: This is an experimental feature. Behavior and configuration may change between releases. We welcome feedback — please open an issue in this repository with your experience and suggestions.
Enables a safe upgrade flow where the operator restarts or replaces nodes in a way that keeps TeamCity available. In short: it upgrades nodes one at a time and ensures at least one node is serving the UI during the process.
-
Standalone Main Node setup
- The operator temporarily creates a Secondary TeamCity Node using the Main Node’s spec.
- Traffic keeps going to this temporary node while the Main Node is restarted/upgraded.
- After the Main Node is healthy again, the temporary node is removed.
-
Multi-node setup (Main Node + Secondary TeamCity Nodes)
- Nodes are upgraded sequentially (for example, one Secondary TeamCity Node at a time, then the Main Node), so at least one node continues to serve requests.
- The operator waits for a node to become healthy before moving on to the next one.
- Enable zero-downtime upgrades with the
update-policyannotation (see Annotations). - This flow assumes your deployment can support multiple nodes briefly running side-by-side (e.g., using a shared database) so the UI remains available during upgrades.
- Sample manifests bundle a demo MySQL Deployment and
database-propertiesSecret. Apply only one such bundle per namespace, or use your own database and Secret. - Full samples:
config/samples/v1beta1/_v1beta1_teamcity_with_zero_downtime_upgrade.yaml(single node) andconfig/samples/v1beta1/_v1beta1_teamcity_with_secondary_node_with_zero_downtime_upgrade.yaml(multi-node).
apiVersion: jetbrains.com/v1beta1
kind: TeamCity
metadata:
name: teamcity-sample-zero-downtime
namespace: default
finalizers:
- "teamcity.jetbrains.com/finalizer"
annotations:
teamcity.jetbrains.com/update-policy: zero-downtime
spec:
image: jetbrains/teamcity-server
databaseSecret:
secret: database-properties
startupPropertiesConfig:
teamcity.startup.maintenance: "false"
teamcity.firstStart.setupAdmin.enabled: "false"
dataDirVolumeClaim:
name: teamcity-data-dir
volumeMount:
name: teamcity-data-dir
mountPath: /storage
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
mainNode:
name: main-node
spec:
requests:
cpu: "1000m"
memory: "2500Mi"The operator uses annotations on the TeamCity custom resource to control upgrade and recreate behavior. Annotations on fields under spec are copied to the corresponding Kubernetes objects (StatefulSet pod templates, Services, Ingresses, PVCs, and so on).
These annotations are set on the TeamCity CR itself (metadata.annotations):
| Key | Value | When to use | Effect |
|---|---|---|---|
teamcity.jetbrains.com/update-policy |
zero-downtime |
Optional. Upgrading image or spec while keeping the UI available. | Operator performs a rolling, one-node-at-a-time upgrade. On a single-node setup it temporarily adds a secondary node; on multi-node setups it upgrades secondaries first, then the main node. Requires a shared database. Experimental — see Zero-downtime upgrades. |
teamcity.jetbrains.com/allow-sts-recreate |
"true" |
Required when adding or changing spec.*.serviceName on an existing TeamCity. |
Webhook allows the change; operator deletes and recreates affected StatefulSet(s) and restarts the node(s). Without this annotation the update is rejected. See Changing serviceName on an existing deployment. |
Example:
metadata:
annotations:
teamcity.jetbrains.com/update-policy: zero-downtime
teamcity.jetbrains.com/allow-sts-recreate: "true"Only set allow-sts-recreate when you intend to recreate StatefulSets; it is not needed for new TeamCity resources created with serviceName already in the spec.
| Key | When to use | Effect |
|---|---|---|
teamcity.jetbrains.com/finalizer |
Recommended on every TeamCity CR (metadata.finalizers). |
On delete, the operator runs cleanup (for example, zero-downtime checkpoint removal) before the CR is removed. Include this finalizer in your manifests — all samples do. |
The operator passes these through to child resources without modification:
| Spec field | Applied to |
|---|---|
spec.mainNode.annotations |
Pod template of the main node StatefulSet |
spec.secondaryNodes[].annotations |
Pod template of each secondary node StatefulSet |
spec.serviceList[].annotations |
Matching Service |
spec.ingressList[].annotations |
Matching Ingress |
spec.serviceAccount.annotations |
TeamCity ServiceAccount |
spec.dataDirVolumeClaim.annotations |
Data directory PVC |
spec.*.nodeDataDirVolumeClaim.annotations |
Per-node data directory PVCs |
spec.persistentVolumeClaims[].annotations |
Additional PVCs |
spec.*.persistentVolumeClaims[].annotations |
Per-node PVCs |
Use these for integration with other cluster components — for example, cluster-autoscaler.kubernetes.io/safe-to-evict on node annotations, NGINX Ingress proxy settings on ingressList entries, or eks.amazonaws.com/role-arn on serviceAccount (see the ServiceAccount example above).
These are labels (not annotations), set automatically on StatefulSets and pods; you normally do not set them on the TeamCity CR:
| Label | Meaning |
|---|---|
teamcity.jetbrains.com/node-name |
Node name from the spec (mainNode.name or secondary node name) |
teamcity.jetbrains.com/role |
main or secondary |
When defining spec.serviceList selectors, use the standard labels the operator sets: app.kubernetes.io/name (TeamCity CR name), app.kubernetes.io/component: teamcity-server, and app.kubernetes.io/part-of: teamcity.
- Migrating from an existing TeamCity installation? See docs/MIGRATION.md for two approaches:
- Approach 1: Move the TeamCity Data Directory to the Operator-managed PVC (simplest).
- Approach 2: Full backup and restore into a new, empty database.
- Ingress integration has been tested with the NGINX Ingress Controller only.
existingClaim: trueis honoured for per-node claims only. Onspec.dataDirVolumeClaimandspec.persistentVolumeClaims[]the operator still creates and owns the PVC.
Yes.
If you run TeamCity on Kubernetes, use the operator instead of writing your own lifecycle automation. It started as the tooling JetBrains needed to run TeamCity Cloud and is actively developed. Some features are still on the roadmap, but it already covers lifecycle management, coordinated upgrades, cluster reconciliation, and stateful workload management — work you would otherwise do yourself with custom scripts, Lambdas, and Terraform. The main difference from a hand-rolled setup is that the operator encodes TeamCity-specific operational knowledge, not just Kubernetes orchestration.
No.
Kubernetes still handles scheduling, container restarts, and infrastructure. The operator adds the TeamCity-specific layer on top: lifecycle management, state reconciliation, and upgrade workflows that understand node roles and database upgrade requirements.
Kubernetes restarts it.
The operator keeps the StatefulSet healthy and relies on Kubernetes reconciliation to bring the node back. In the meantime, secondary nodes keep serving the UI and running builds continue, but no new builds start, because build queue management is a main node responsibility. The result is degraded service rather than an outage.
Generally no.
It is technically possible — for example, an AWS Lambda driving the TeamCity API — but the main node has exclusive responsibilities, and transferring them automatically introduces edge cases, particularly around agent assignment. Letting Kubernetes recreate the failed main node is the safer option today. Making nodes more interchangeable is the longer-term direction.
Not in the operator.
Kubernetes leader election was explored as a proof of concept to reduce failover time, but it was not incorporated because of unresolved edge cases in reassigning the main node role. The operator follows the Kubernetes restart model instead of automatic promotion.
In most deployments, no.
Rather than dedicating one node to VCS and another to change processing, let secondary nodes carry the same responsibilities. Identical nodes give you redundancy, simpler scaling, and no single point of failure per responsibility: if one node becomes unavailable, another continues the work immediately.
The main production deployment has one dedicated main node, several interchangeable worker nodes with the same responsibilities, and additional UI-focused nodes behind a load balancer. Proxy routing (HAProxy, in our case) directs interactive UI traffic to the UI nodes while worker nodes handle build processing, which keeps the UI responsive under heavy load.
Each node is managed as its own StatefulSet so it can have node-specific environment variables, configuration, responsibilities, and an independent lifecycle. A single StatefulSet with multiple replicas would make that level of per-node customization much harder.
Not currently, partly because of the per-node StatefulSet design.
Additional scaling capabilities are on the roadmap.
Vertically first.
Identify the actual bottleneck, increase CPU or memory for the affected node, move to a larger instance type if needed, and only then add TeamCity nodes. This matters most for the main node, which cannot be scaled out by adding replicas.
CPU utilization alone is often misleading.
Depending on the workload, the bottleneck may be Kotlin DSL compilation, memory, Git operations, build queue size, or another TeamCity-specific characteristic. Measure and identify the bottleneck before changing resources.
- Development and local debugging instructions have been moved to docs/DEVELOPMENT.md.
- Issues and PRs are welcome.