Azure Kubernetes - JMeter No X11 DISPLAY variable was set

10/5/2021

I am developing a JMeter Dynamic Master-Slave Perf Environment on top of Azure Kubernetes Service. In my JMeter Slave Deployment, the pod is getting into the CrashLoopBackOff state and creating another Pod again and this continues as a loop. While looking at the JMeter Slave logs, I have found out this error ​ An error occurred: No X11 DISPLAY variable was set, but this program performed an operation which requires it.

Currently, I am using Helm to deploy the pods and below are my jmeter-slave-deployment.yaml and values.yaml files.

jmeter-slave-deployment.yaml file

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.dep.name }}
  namespace: perf-platform
  labels:
    app.kubernetes.io/name: {{ .Values.dep.name }}

spec:
  replicas: {{ .Values.slave.replicaCount }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ .Values.dep.name }}

  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ .Values.dep.name }}

    spec:
      
      containers:
     
      - name: distributed-jmeter-slave
        image: "{{ .Values.slave.image }}:{{ .Values.slave.tag }}"
        imagePullPolicy: {{ .Values.slave.pullPolicy }}

        env:
        - name: HEAP
          value: "-Xms{{ .Values.slave.heap.xms1.memory }} -Xmx{{ .Values.slave.heap.xms2.memory }}"
        
        ports:
          - containerPort: 50000
          - containerPort: 1099
        
        resources:
          requests:
            memory: "{{ .Values.slave.res.req.mem }}"
            cpu: "{{ .Values.slave.res.req.cpu }}"
          limits:
            memory: "{{ .Values.slave.res.lim.mem }}"
            cpu: "{{ .Values.slave.res.lim.cpu }}"

values.yaml file

#JMeter Slave Configuration
dep:
  name: distributed-jmeter
slave:
  replicaCount: 1
  image: gsengun/jmeter
  tag: 5.4.1
  pullPolicy: IfNotPresent
  res:
    req:
      mem: "1024Mi"
      cpu: "100m"
    lim:
      mem: "1024Mi"
      cpu: "100m"
  heap:
    xms1:
      memory: "512m"
    xms2:
      memory: "512m"
-- Sahan Jayawardena
azure
jmeter
kubernetes
kubernetes-helm

1 Answer

10/6/2021

No X11 DISPLAY variable was set error means that you're trying to run JMeter in GUI mode and your (or whatever) image you're using doesn't have X server installed/running

I fail to see the appropriate command to run JMeter Slave process so my expectation is that you need to amend your jmeter-slave-deployment.yaml to have command directive specified like:

command: ["jmeter-server"]

if you like to copy and paste:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ .Values.dep.name }}
  namespace: perf-platform
  labels:
    app.kubernetes.io/name: {{ .Values.dep.name }}

spec:
  replicas: {{ .Values.slave.replicaCount }}
  selector:
    matchLabels:
      app.kubernetes.io/name: {{ .Values.dep.name }}

  template:
    metadata:
      labels:
        app.kubernetes.io/name: {{ .Values.dep.name }}

    spec:
      
      containers:
    
      - name: distributed-jmeter-slave
        image: "{{ .Values.slave.image }}:{{ .Values.slave.tag }}"
        imagePullPolicy: {{ .Values.slave.pullPolicy }}
        command: ["jmeter-server"]

        env:
        - name: HEAP
          value: "-Xms{{ .Values.slave.heap.xms1.memory }} -Xmx{{ .Values.slave.heap.xms2.memory }}"
        
        ports:
          - containerPort: 50000
          - containerPort: 1099
        
        resources:
          requests:
            memory: "{{ .Values.slave.res.req.mem }}"
            cpu: "{{ .Values.slave.res.req.cpu }}"
          limits:
            memory: "{{ .Values.slave.res.lim.mem }}"
            cpu: "{{ .Values.slave.res.lim.cpu }}"

More information:

-- Dmitri T
Source: StackOverflow