Eugenio Gastelum
07/25/2023, 8:17 PMFlinkDeployment, and it works well if I sink to console, based from this repo example. But I am currently just stuck on trying to add a source/sink .jar connector, which I think it might be a very simple java thing I can't see, like some .pom file. I've used those dependencies on local pyflink before with no problems, but on k8s operator they don't seem to be found by python even though it does locally with no problems. Maybe it's a simple java thing I am not seeing? (I don't know java)
I would also love to help to document how I did it for other future folks that might come to the same question, if only I knew how to include the connectors .jar in pyflink k8s operator. I think the least I could do in that regard is publishing this stackoverflow question with more details on how I am doing it, but it's still unfinished as it's asking about the connectors. I think it's very close to work and probably I am missing just some small java detail I can't find to make it work.
I would love if someone could help me including connector's dependencies to pyflink with the k8s operator. I would be very grateful!Huib
07/25/2023, 8:20 PMEugenio Gastelum
07/25/2023, 8:23 PMEugenio Gastelum
07/25/2023, 8:24 PMt_env.get_config().get_configuration().set_string(
"pipeline.jars",
"file:///" + CURRENT_DIR + "/lib/flink-sql-connector-kinesis-1.16.2.jar",
)Huib
07/25/2023, 8:27 PM/opt/flink/usrlib/ made flink pick them up, where did you put yours?Huib
07/25/2023, 8:27 PMEugenio Gastelum
07/25/2023, 8:28 PM/opt/flink/usrlib/libEugenio Gastelum
07/25/2023, 8:28 PMFROM flink:1.16
# install python3: it has updated Python to 3.9 in Debian 11 and so install Python 3.7 from source, \
# it currently only supports Python 3.6, 3.7 and 3.8 in PyFlink officially.
RUN apt-get update -y && \
apt-get install -y build-essential libssl-dev zlib1g-dev libbz2-dev libffi-dev && \
wget <https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz> && \
tar -xvf Python-3.7.9.tgz && \
cd Python-3.7.9 && \
./configure --without-tests --enable-shared && \
make -j6 && \
make install && \
ldconfig /usr/local/lib && \
cd .. && rm -f Python-3.7.9.tgz && rm -rf Python-3.7.9 && \
ln -s /usr/local/bin/python3 /usr/local/bin/python && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# install PyFlink
RUN pip3 install "apache-flink>=1.16.0,<1.17.1"
# add python script
USER flink
RUN mkdir /opt/flink/usrlib
ADD python_demo_kinesis.py /opt/flink/usrlib/python_demo.py
#Inside lib directory I have the flink-sql-connector-kinesis-1.16.2.jar
ADD lib /opt/flink/usrlib/libEugenio Gastelum
07/25/2023, 8:29 PM/opt/flink/usrlib/lib. I also ran that image locally with docker and got in the bash to confirm the .jar was correctly located at /opt/flink/usrlib/lib and it doesHuib
07/25/2023, 8:34 PMHuib
07/25/2023, 8:35 PMEugenio Gastelum
07/25/2023, 8:35 PMEugenio Gastelum
07/25/2023, 8:47 PMEugenio Gastelum
07/25/2023, 8:47 PMEugenio Gastelum
07/25/2023, 8:54 PMEugenio Gastelum
07/25/2023, 8:54 PMHuib
07/25/2023, 9:01 PMEugenio Gastelum
07/25/2023, 9:01 PM