Background: You need to set up a local K8S cluster, and then deploy Flink to the K8S cluster

Here’s a quick and easy way to do it

Ps: AFTER reading all kinds of blogs for a long time, I need to set up three or five virtual machines to deploy the cluster, but I just want to build a test environment, set up three or five virtual machines is too expensive, so I introduce the following way

docker desktop

Download docker Desktop and install it. If you encounter problems, follow the instructions to set it up. There are basically no problems here, just some minor problems on WSL

Then open the Settings and there is a K8S at the bottom. Check the first one and wait. It is very easy to deploy the K8S

helm

Docker desktop helps us to fix the k8S environment, but helm(k8S package management tool) still need to install, install the way is very simple, directly go to the official website to download the package, and decompress the file looks like this:We then add the directory to the environment variable so that we can use helm globally

flink

The helm is used here to deploy flink tasks. First, you need to find the Flink repository from the helm and download it locally

According to the guidelines on the website, we need to enter several commands

$ helm repo add riskfocus https://riskfocus.github.io/helm-charts-public
$ helm repo update
$ helm install --name my-flink --namespace flink riskfocus/flink
Copy the code

And here, the worst part of the deployment

Ps: On the first day of that day, I came into contact with K8S and HELM. I was not familiar with many instructions, so I felt that this place was a big pit

1 the pit

— Name does not exist? I’m not sure about this, but if I encounter this problem, I can simply delete –name

Pit 2

After Helm install, Flink’s services cannot be accessed through the native localhost:8081

I blame myself for not reading the NOTES carefully.

There are still a few more steps to follow, namely three instructions in NOTES, but win10 pit again reflected

First, there is no export directive, so how to save the country?

There’s no need to set the environment variable here, we just need to know what the value of POD_NAME is, okay

So:

Well, it only takes 10 minutes to deploy Flink to k8S and set up a simple test environment!

Happy to write Java!