If i use for example this dockerfile :
FROM golang:1.19-alpine as builder
#Install K6 (version can be changed)
ADD /grafana/k6/releases/download/v0.42.0/k6-v0.42.0-linux-amd64.tar.gz k6-v0.42.0-linux-amd64.tar.gz
RUN tar -xzf k6-v0.42.0-linux-amd64.tar.gz
RUN mv k6-v0.42.0-linux-amd64/k6 /usr/bin/k6
RUN rm -rf k6-v0.42.0-linux-amd64.tar.gz k6-v0.42.0-linux-amd64
#Install xk6
RUN go install xk6@latest
RUN xk6 build --output /k6 --with /grafana/xk6-sql@latest
RUN rm -rf /usr/bin/k6
RUN mv /k6 /usr/bin/k6
FROM alpine:latest AS runtime
RUN apk add --no-cache ca-certificates=~20220614 && \
adduser -D -u 12345 -g 12345 k6
COPY --from=builder /usr/bin/k6 /usr/bin/k6
USER 12345
WORKDIR /home/k6
ENTRYPOINT ["k6"]
I create a this custom resource :
apiVersion: k6.io/v1alpha1
kind: K6
metadata:
name: k6-sample
spec:
parallelism: 4
script:
configMap:
name: stress-test
file: test.js
runner:
image: private.registry:latest # just an example ( the image is pulled correctly )
my test.js file would be :
import http from 'k6/http';
import { check } from 'k6';
export const options = {
stages: [
{ target: 200, duration: '30s' },
{ target: 0, duration: '30s' },
],
};
export default function () {
const result = http.get('https://test-api.k6.io/public/crocodiles/');
check(result, {
'http response status code is 200': result.status === 200,
});
}
the initializer pod gets this error :
standard_init_linux.go:228: exec user process caused: exec format error
do we have any way of replacing the xk6 binary built with k6 binary and then use it ?
I am successful in triggering the base loadimpact/k6:latest
image but somehow, the custom resources with replaced k6 binary doesn’t work
*Note : tested the docker container locally and it works as intended.
*Note 2 : was not allowed to post more than 2 links in the post that’s why the dockerfile is incomplete