Home > Software design >  Apache Flink Kubernetes operator - how to override the Docker entrypoint?
Apache Flink Kubernetes operator - how to override the Docker entrypoint?

Time:09-06

I tried to override the container entry point of a Flink application in a Dockerfile, but it looks like that the Apache Flink kubernetes operator ignores it.

The Dockerfile is the following:

FROM flink:1.14.2-scala_2.12-java11

ENV FLINK_HOME=/opt/flink

COPY custom-docker-entrypoint.sh /
RUN chmod a x /custom-docker-entrypoint.sh
COPY --chown=flink:flink --from=build /target/*.jar /opt/flink/flink-web-upload/

ENTRYPOINT ["/custom-docker-entrypoint.sh"]
EXPOSE 6123 8081
CMD ["help"]

The definition of the FlinkDeployment uses the new image:

apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: flink-example
  namespace: default
spec:
  image: "flink-example:0.1.0"
#...

In the description of the pod

kubectl describe pod flink-example

I see the following output:

Containers:
  flink-main-container:
    Command:
      /docker-entrypoint.sh

I also tried to define the custom-docker-entrypoint.sh in the main container's command:

apiVersion: flink.apache.org/v1beta1
kind: FlinkDeployment
metadata:
  name: flink-example
  namespace: default
spec:
  flinkVersion: v1_14
  image: "flink-example:0.1.0"
  podTemplate:
    apiVersion: v1
    kind: Pod
    metadata:
      name: pod-template
    spec:
      containers:
        - name: flink-main-container
#          command: [ 'sh','-c','/custom-docker-entrypoint.sh' ]
          command: [ "/custom-docker-entrypoint.sh" ]

Thank you.

CodePudding user response:

You can overwrite it via:

  flinkConfiguration:
    kubernetes.entry.path: "/custom-docker-entrypoint.sh"

The Operator (by default) uses Flink's native Kubernetes integration. See: https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/config/#kubernetes-entry-path

  • Related