apiVersion: apps/v1
kind: Deployment
metadata:
  name: flink-taskmanager
spec:
  replicas: 2
  selector:
    matchLabels:
      app: flink
      component: taskmanager
  template:
    metadata:
      labels:
        app: flink
        component: taskmanager
        deploymentId: "0000"
      annotations:
        prometheus.io/port: "9249"
        prometheus.io/scrape: "true"
    spec:
      containers:
      - name: taskmanager
        image: flink:1.11.1-scala_2.11
        args: ["taskmanager"]
        #env:
        #- name: LD_PRELOAD
          #value: /usr/local/lib/libjemalloc.so
        #- name: MALLOC_CONF
          #value: >-
            #prof_leak:true,prof:true,lg_prof_interval:29,lg_prof_sample:17,prof_prefix:/jemalloc/jeprof-$(HOSTNAME),prof_final:true
        resources:
          limits:
            cpu: "1"
            memory: 4G
          requests:
            cpu: "1"
            memory: 4G
        ports:
        - containerPort: 6122
          name: rpc
        - containerPort: 6125
          name: query-state
        livenessProbe:
          tcpSocket:
            port: 6122
          initialDelaySeconds: 30
          periodSeconds: 60
        volumeMounts:
        - name: flink-config-volume
          mountPath: /opt/flink/conf/
        - name: chkpts
          mountPath: /chkpts
        securityContext:
          runAsUser: 9999  # refers to user _flink_ from official flink image, change if necessary
      volumes:
      - name: flink-config-volume
        configMap:
          name: flink-config
          items:
          - key: flink-conf.yaml
            path: flink-conf.yaml
          - key: log4j-console.properties
            path: log4j-console.properties
      - name: chkpts
        emptyDir: {}
