Skip to content

Teamcity

Deployment

YAML
apiVersion: apps/v1
kind: Deployment
metadata:
  name: teamcity-deployment
  labels:
    app: teamcity
spec:
  replicas: 1
  selector:
    matchLabels:
      app: teamcity
  template:
    metadata:
      labels:
        app: teamcity
    spec:
      containers:
      - name: teamcity
        image: jetbrains/teamcity-server
        ports:
        - containerPort: 8111
        resources:
          limits:
            cpu: 2
            memory: 4000Mi
          requests:
            cpu: 500m
            memory: 500Mi
        volumeMounts:
        - mountPath: /data/teamcity_server/datadir
          name: teamcity-data
        - mountPath: /opt/teamcity/logs
          name: teamcity-logs
      restartPolicy: Always
      volumes:
      - name: teamcity-data
        persistentVolumeClaim:
          claimName: teamcity-data
      - name: teamcity-logs
        persistentVolumeClaim:
          claimName: teamcity-logs

Service

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

Volumes

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

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

---

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

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

Kustomize | kustomization.yaml

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

Ingress | If needed

YAML
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: teamcity-ingress
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/ssl-passthrough: "true"
    nginx.ingress.kubernetes.io/rewrite-target: /
    # kubernetes.io/tls-acme: "true"
    # If you encounter a redirect loop or are getting a 307 response code
    # then you need to force the nginx ingress to connect to the backend using HTTPS.
    #
    # nginx.ingress.kubernetes.io/backend-protocol: "HTTPS"
spec:
  ingressClassName: nginx
  tls:
  - hosts:
    -  teamcity.example.com
    secretName: example-cert
  rules:
  - host: teamcity.example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name:  teamcity-service
            port:
              number: 8111
Back to top