kubernetes-sigs / sig-windows-tools

Repository for tools and artifacts related to the sig-windows charter in Kubernetes. Scripts to assist kubeadm and wincat and flannel will be hosted here.
Apache License 2.0
123 stars 123 forks source link

Flannel mistake #336

Closed FangKee closed 1 year ago

FangKee commented 1 year ago

微信截图_20230713105928 Thank you for @Mik4sa update,I have been researching this recently。But Flannel there's still this mistake。 Using Calico was successful And should FLANNEL_VERSION be updated? There is currently no v0.21.5, only v0.14.0

kubernetes: v1.27.1 Windows Server: 2022 Datacenter

FangKee commented 1 year ago

Write files so the kubeconfig points to correct locations

Ŀ¼: C:\var\lib

Mode LastWriteTime Length Name


d----- 2023/7/13 10:56 kube-proxy
Finding sourcevip �޷��� Null ������������� ����λ�� C:\hpc\kube-proxy\start.ps1:19 �ַ�: 9

It feels like it's a path issue. When I execute flannel start.ps1 , it will show that Path is empty

Mik4sa commented 1 year ago

You need to build the images for flannel and kube-proxy on your own. I'm running flannel successfully on v0.21.5

FangKee commented 1 year ago

image

I already build flannel

FangKee commented 1 year ago

You need to build the images for flannel and kube-proxy on your own. I'm running flannel successfully on v0.21.5

On the Windows node ? Sorry, I'm a novice please can you tech me look at the working steps Thank you @Mik4sa very much. It's important to me

FangKee commented 1 year ago

curl -L https://raw.githubusercontent.com/kubernetes-sigs/sig-windows-tools/master/hostprocess/flannel/flanneld/flannel-overlay.yml | sed 's/FLANNEL_VERSION/v0.21.5/g' | sed "s/KUBERNETES_SERVICE_HOST_VALUE/$kubernetesServiceHost/g" | sed "s/KUBERNETES_SERVICE_PORT_VALUE/$kubernetesServicePort/g" | kubectl apply -f -

sigwindowstools/flannel:FLANNEL_VERSION-hostprocess not have 0.21.5 only v0.14.0 0.13.0 0.17.0 image

Mik4sa commented 1 year ago

I'm a novice please can you tech me look at the working steps

I see. Let me clarify some terminology first.

I already build flannel

As far as I can see you didn't build an own image for flannel instead you deployed an existing image. The problem with existing images on docker hub is that they no longer match the guide on the master branch. So instead you need to build/create and push your own image to docker hub or any other accessible registry from your cluster and you that in your manifests.

In case they fit your needs you can use my images but keep in mind that they are subject to change at anytime. You are better advised to create your own.

These are my images:


To build your own images prepare a docker installation powered by linux containers on a windows system. Execute this command to create the builder needed to build flannel and kube-proxy:

docker buildx create --name img-builder --use --platform windows/amd64

Afterwars clone this repo and checkout the master branch. Open this folder in a terminal /hostprocess/flannel/flanneld. Set $flannelVersion and $repository accordingly. I used for example $flannelVersion="v0.21.5" and $repository="mik4sa". Last but not least execute this command to build and push your image:

docker buildx build --provenance=false --sbom=false --platform windows/amd64 --output=type=registry --pull --build-arg=flannelVersion=$flannelVersion -f Dockerfile -t $repository/flannel:$flannelVersion-hostprocess .

Next open this folder in a terminal /hostprocess/flannel/kube-proxy. Set $proxyVersion and $repository accordingly. I used for example $proxyVersion="v1.27.1" and $repository="mik4sa". Last but not least execute this command to build and push your image:

docker buildx build --provenance=false --sbom=false --platform windows/amd64 --output=type=registry --pull --build-arg=k8sVersion=$proxyVersion -f Dockerfile -t $repository/kube-proxy:$proxyVersion-flannel-hostprocess .

In the manifest you apply, so flannel-overlay.yml and kube-proxy.yml you need to reference the image you just created. So change image: sigwindowstools/[...] to image: mik4sa/[...]

FangKee commented 1 year ago

I'm a novice please can you tech me look at the working steps

I see. Let me clarify some terminology first.

I already build flannel

As far as I can see you didn't build an own image for flannel instead you deployed an existing image. The problem with existing images on docker hub is that they no longer match the guide on the master branch. So instead you need to build/create and push your own image to docker hub or any other accessible registry from your cluster and you that in your manifests.

In case they fit your needs you can use my images but keep in mind that they are subject to change at anytime. You are better advised to create your own.

These are my images:

  • mik4sa/flannel:v0.21.5-hostprocess
  • mik4sa/kube-proxy:v1.27.1-flannel-hostprocess
  • mik4sa/kube-proxy:v1.27.2-flannel-hostprocess

To build your own images prepare a docker installation powered by linux containers on a windows system. Execute this command to create the builder needed to build flannel and kube-proxy:

docker buildx create --name img-builder --use --platform windows/amd64

Afterwars clone this repo and checkout the master branch. Open this folder in a terminal /hostprocess/flannel/flanneld. Set $flannelVersion and $repository accordingly. I used for example $flannelVersion="v0.21.5" and $repository="mik4sa". Last but not least execute this command to build and push your image:

docker buildx build --provenance=false --sbom=false --platform windows/amd64 --output=type=registry --pull --build-arg=flannelVersion=$flannelVersion -f Dockerfile -t $repository/flannel:$flannelVersion-hostprocess .

Next open this folder in a terminal /hostprocess/flannel/kube-proxy. Set $proxyVersion and $repository accordingly. I used for example $proxyVersion="v1.27.1" and $repository="mik4sa". Last but not least execute this command to build and push your image:

docker buildx build --provenance=false --sbom=false --platform windows/amd64 --output=type=registry --pull --build-arg=k8sVersion=$proxyVersion -f Dockerfile -t $repository/kube-proxy:$proxyVersion-flannel-hostprocess .

In the manifest you apply, so flannel-overlay.yml and kube-proxy.yml you need to reference the image you just created. So change image: sigwindowstools/[...] to image: mik4sa/[...]

Thank you very very much,Now it's successful. This working steps Helped me a lot, a lot
heartfelt thanks @Mik4sa

FangKee commented 1 year ago

heartfelt thanks @Mik4sa