基于go编译环境编译virtual-kubelet用于kubernetes对接openstack-zun

Emily ·
更新时间:2024-11-13
· 820 次阅读

1、编译环境介绍

编译机器为ubuntu虚拟机
虚拟机镜像ubuntu版本为

cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"

注:编译会下载第三方包,所以编译环境需要连互联网

2、构建编译环境 2.1、下载go

go最新稳定版本为v1.13.5

wget https://studygolang.com/dl/golang/go1.13.5.linux-amd64.tar.gz . 2.2、构建编译环境 tar -C /opt/ -zxvf go1.13.5.linux-amd64.tar.gz export GOROOT=/opt/go export PATH=$PATH:$GOROOT/bin export GOPATH=~/gopath mkdir -p ${GOPATH}/src/github.com/virtual-kubelet cd ${GOPATH}/src/github.com/virtual-kubelet

注:如果需要持久化环境变量,可以将环境变量放到profile中

3、编译virtual-kubelet 3.1、下载virtual-kubelet代码 git clone https://github.com/virtual-kubelet/openstack-zun.git 3.2、编译 cd openstack-zun make build 3.3、版本

编译好的版本位于bin目录下

# ls -l bin total 41364 -rwxr-xr-x 1 root root 42355511 Jan 7 19:06 virtual-kubelet 4、编译日志 # make build CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' -o bin/virtual-kubelet -ldflags='-X "main.buildVersion=781b46a" -X "main.buildTime=2020-01-07-11:03 UTC"' ./cmd/virtual-kubelet go: downloading github.com/virtual-kubelet/virtual-kubelet v0.10.0 go: downloading contrib.go.opencensus.io/exporter/ocagent v0.5.0 go: downloading k8s.io/client-go v11.0.1-0.20190606204521-b8faab9c5193+incompatible go: downloading github.com/spf13/cobra v0.0.5 go: downloading github.com/sirupsen/logrus v1.2.0 go: extracting github.com/spf13/cobra v0.0.5 go: extracting github.com/sirupsen/logrus v1.2.0 go: downloading k8s.io/api v0.0.0-20190606204050-af9c91bd2759 go: downloading k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d go: extracting contrib.go.opencensus.io/exporter/ocagent v0.5.0 go: extracting k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d go: extracting k8s.io/api v0.0.0-20190606204050-af9c91bd2759 go: extracting k8s.io/client-go v11.0.1-0.20190606204521-b8faab9c5193+incompatible go: downloading go.opencensus.io v0.19.3 go: extracting github.com/virtual-kubelet/virtual-kubelet v0.10.0 go: downloading google.golang.org/grpc v1.20.1 go: downloading github.com/gogo/protobuf v1.1.1 go: downloading k8s.io/kubernetes v1.14.3 go: downloading google.golang.org/api v0.4.0 go: extracting go.opencensus.io v0.19.3 go: downloading k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 go: downloading k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a go: extracting k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a go: downloading golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 go: extracting github.com/gogo/protobuf v1.1.1 go: extracting k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 go: extracting google.golang.org/grpc v1.20.1 go: downloading github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d go: downloading github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf go: extracting golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 go: downloading golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a go: extracting github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf go: downloading github.com/imdario/mergo v0.3.7 go: extracting github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d go: extracting github.com/imdario/mergo v0.3.7 go: downloading golang.org/x/net v0.0.0-20190311183353-d8887717615a go: extracting golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a go: downloading github.com/hashicorp/golang-lru v0.5.0 go: extracting github.com/hashicorp/golang-lru v0.5.0 go: extracting golang.org/x/net v0.0.0-20190311183353-d8887717615a go: downloading github.com/gorilla/mux v1.7.2 go: extracting github.com/gorilla/mux v1.7.2 go: downloading github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef go: extracting github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef go: downloading google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 go: extracting google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 go: downloading golang.org/x/text v0.3.0 go: extracting google.golang.org/api v0.4.0 go: extracting golang.org/x/text v0.3.0 go: downloading github.com/gophercloud/gophercloud v0.2.0 go: downloading github.com/BurntSushi/toml v0.3.1 go: extracting github.com/BurntSushi/toml v0.3.1 go: extracting github.com/gophercloud/gophercloud v0.2.0 go: downloading github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c go: extracting github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c go: extracting k8s.io/kubernetes v1.14.3 go: downloading k8s.io/apiserver v0.0.0-20190615170205-3722cb685593 go: extracting k8s.io/apiserver v0.0.0-20190615170205-3722cb685593 go: finding github.com/virtual-kubelet/virtual-kubelet v0.10.0 go: finding github.com/spf13/cobra v0.0.5 go: finding github.com/sirupsen/logrus v1.2.0 go: finding contrib.go.opencensus.io/exporter/ocagent v0.5.0 go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 go: finding go.opencensus.io v0.19.3 go: finding github.com/BurntSushi/toml v0.3.1 go: finding github.com/gophercloud/gophercloud v0.2.0 go: finding k8s.io/api v0.0.0-20190606204050-af9c91bd2759 go: finding k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d go: finding k8s.io/client-go v11.0.1-0.20190606204521-b8faab9c5193+incompatible go: finding github.com/gorilla/mux v1.7.2 go: finding github.com/gogo/protobuf v1.1.1 go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a go: finding github.com/hashicorp/golang-lru v0.5.0 go: finding k8s.io/kubernetes v1.14.3 go: finding github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf go: finding google.golang.org/grpc v1.20.1 go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a go: finding github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d go: finding github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef go: finding github.com/imdario/mergo v0.3.7 go: finding google.golang.org/api v0.4.0 go: finding google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19 go: finding k8s.io/kube-openapi v0.0.0-20190228160746-b3a7cee44a30 go: finding k8s.io/apiserver v0.0.0-20190615170205-3722cb685593 go: finding k8s.io/utils v0.0.0-20190607212802-c55fbcfc754a go: finding github.com/docker/spdystream v0.0.0-20181023171402-6480d4af844c go: finding golang.org/x/text v0.3.0
作者:vxlinux2019



环境 GO openstack virtual kubernetes

需要 登录 后方可回复, 如果你还没有账号请 注册新账号