Skip to content

Teamcity Agent

Deployment

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
  name: teamcity-agent-deployment
  labels:
    app: teamcity-agent
spec:
  replicas: 1
  selector:
    matchLabels:
      app: teamcity-agent
  template:
    metadata:
      labels:
        app: teamcity-agent
    spec:
      containers:
      - name: teamcity-agent
        image: jetbrains/teamcity-agent:latest
        ports:
        - containerPort: 9090
        resources:
          limits:
            cpu: 2
            memory: 4000Mi
          requests:
            cpu: 50m
            memory: 50Mi
        volumeMounts:
        - mountPath: /data/teamcity_agent/conf
          name: teamcity-agent
      restartPolicy: Always
      volumes:
      - name: teamcity-agent
        persistentVolumeClaim:
          claimName: teamcity-agent

Service

YAML
apiVersion: v1
kind: Service
metadata:
  name: teamcity-agent-service
  labels:
    app: teamcity-agent
spec:
  selector:
    app: teamcity-agent
  ports:
    - protocol: TCP
      port: 9090

Volumes

YAML
apiVersion: v1
kind: PersistentVolume
metadata:
  namespace: default
  name: teamcity-agent
  labels:
    type: local
spec:
  storageClassName: teamcity-agent
  capacity:
    storage: 10Gi
  accessModes:
    - ReadWriteMany
  hostPath:
    path: "/kindvol/teamcity/teamcity-agent"

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: teamcity-agent
  namespace: default
spec:
  storageClassName: teamcity-agent
  accessModes:
    - ReadWriteMany
  resources:
    requests:
      storage: 10Gi

RBAC

YAML
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: teamcity:manage-agents
rules:
- apiGroups: [""]
  resources: ["namespaces"]
  verbs: ["list", "get"]
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "create", "list", "delete"]
- apiGroups: ["extensions", "apps"]
  resources: ["deployments"]
  verbs: ["list", "get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: teamcity:manage-agents
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: teamcity:manage-agents
subjects:
  # proper RoleBinding subject depends on your Authentication strategy
  # use one of examples below

  # if you use OIDC/Certificate auth strategies
  - kind: User
    name: teamcity

  # if you use Service account
  - kind: ServiceAccount
    name: teamcity

Kustomization

YAML
resources:
- deployment.yaml
- rbac.yaml
- service.yaml
- volume.yaml

Agent config

Properties
name=Agent 1-2
ownPort=9090
serverUrl=teamcity-service:8111

workDir=../work
tempDir=../temp
systemDir=../system

teamcity.docker.use.sudo=true


authorizationToken=71723e836df10d65390420820fe3451c
Back to top