Last active
July 22, 2021 04:13
-
-
Save zhangguanzhang/1c3382f965107d072d68be6e4341b275 to your computer and use it in GitHub Desktop.
flannel-compile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
``` | |
wget https://github.com/multiarch/qemu-user-static/releases/download/v3.0.0/qemu-x86_64-static.tar.gz | |
docker run --privileged -ti --rm --name flannel --net host -e GOARCH=amd64 \ | |
--cap-add=NET_ADMIN --cap-add=SYS_ADMIN \ | |
-u $( id -u):$( id -g) \ | |
-v $PWD/dist/qemu-amd64-static:/usr/bin/qemu-amd64-static \ | |
-v $PWD:/go/src/github.com/coreos/flannel:ro \ | |
-v $PWD/dist:/go/src/github.com/coreos/flannel/dist \ | |
-v /run:/run \ | |
--workdir=/go/src/github.com/coreos/flannel \ | |
golang:1.16.5 /bin/bash | |
go install github.com/go-delve/delve/cmd/dlv@latest | |
CGO_ENABLED=1 GO111MODULE=off go build -o dist/flanneld \ | |
-gcflags="all=-trimpath=$PWD -N -l" \ | |
-asmflags "all=-trimpath=$PWD" \ | |
-ldflags '-X github.com/coreos/flannel/version.Version=v0.11.0-go1.16.3 -extldflags "-static"' main.go | |
mkdir -p /etc/cni/net.d/ | |
cat <<EOF > /etc/cni/net.d/10-flannel.conflist | |
{ | |
"name": "cbr0", | |
"cniVersion": "0.3.1", | |
"plugins": [ | |
{ | |
"type": "flannel", | |
"delegate": { | |
"hairpinMode": true, | |
"isDefaultGateway": true | |
} | |
}, | |
{ | |
"type": "portmap", | |
"capabilities": { | |
"portMappings": true | |
} | |
} | |
] | |
} | |
EOF | |
mkdir -p /etc/kube-flannel | |
cat <<EOF > /etc/kube-flannel/net-conf.json | |
{ | |
"Network": "10.187.0.0/16", | |
"Backend": { | |
"Type": "vxlan" | |
} | |
} | |
EOF | |
export NODE_NAME=10.13.4.78 | |
dlv exec ./dist/flanneld -- --kube-subnet-mgr --kubeconfig-file=./dist/kubeconfig --ip-masq -v=4 | |
``` |
Author
zhangguanzhang
commented
Jul 22, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment