【问题标题】:How to execute the master go scritpt in kubernetes如何在 Kubernetes 中执行主 go 脚本
【发布时间】:2020-05-02 01:49:04
【问题描述】:

我们在以下 URL 中找到了测试列表。谁能让我知道执行端到端 kubernetes 测试的测试列表的主要 go 脚本。 https://github.com/kubernetes/kubernetes/tree/master/test/e2e

我们已经在 Ubuntu 中安装了 kubernetes,并尝试获取执行所有 e2e 测试的主脚本。

我在安装 kubetest 时遇到问题。请帮我解决问题。完整信息如下。

chan@coe-OptiPlex-3060:~$ sudo go get -v -u k8s.io/test-infra/kubetest
Fetching https://k8s.io/test-infra/kubetest?go-get=1
Parsing meta tags from https://k8s.io/test-infra/kubetest?go-get=1 (status code 200)
get "k8s.io/test-infra/kubetest": found meta tag get.metaImport{Prefix:"k8s.io/test-infra", VCS:"git", RepoRoot:"https://github.com/kubernetes/test-infra"} at https://k8s.io/test-infra/kubetest?go-get=1
get "k8s.io/test-infra/kubetest": verifying non-authoritative meta tag
Fetching https://k8s.io/test-infra?go-get=1
Parsing meta tags from https://k8s.io/test-infra?go-get=1 (status code 200)
k8s.io/test-infra (download)
github.com/Azure/azure-sdk-for-go (download)
github.com/Azure/go-autorest (download)
github.com/dgrijalva/jwt-go (download)
github.com/Azure/azure-storage-blob-go (download)
github.com/Azure/azure-pipeline-go (download)
github.com/mattn/go-ieproxy (download)
github.com/aws/aws-k8s-tester (download)
package github.com/aws/aws-k8s-tester/ekstester: cannot find package "github.com/aws/aws-k8s-tester/ekstester" in any of:
    /usr/lib/go-1.10/src/github.com/aws/aws-k8s-tester/ekstester (from $GOROOT)
    /home/coe/go/src/github.com/aws/aws-k8s-tester/ekstester (from $GOPATH)
github.com/aws/aws-sdk-go (download)
github.com/docker/docker (download)
github.com/pelletier/go-toml (download)
github.com/satori/go.uuid (download)
github.com/spf13/pflag (download)
Fetching https://golang.org/x/crypto/ssh?go-get=1
Parsing meta tags from https://golang.org/x/crypto/ssh?go-get=1 (status code 200)
get "golang.org/x/crypto/ssh": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/ssh?go-get=1
get "golang.org/x/crypto/ssh": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto?go-get=1
Parsing meta tags from https://golang.org/x/crypto?go-get=1 (status code 200)
golang.org/x/crypto (download)
Fetching https://golang.org/x/crypto/chacha20?go-get=1
Parsing meta tags from https://golang.org/x/crypto/chacha20?go-get=1 (status code 200)
get "golang.org/x/crypto/chacha20": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/chacha20?go-get=1
get "golang.org/x/crypto/chacha20": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto/internal/subtle?go-get=1
Parsing meta tags from https://golang.org/x/crypto/internal/subtle?go-get=1 (status code 200)
get "golang.org/x/crypto/internal/subtle": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/internal/subtle?go-get=1
get "golang.org/x/crypto/internal/subtle": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto/curve25519?go-get=1
Parsing meta tags from https://golang.org/x/crypto/curve25519?go-get=1 (status code 200)
get "golang.org/x/crypto/curve25519": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/curve25519?go-get=1
get "golang.org/x/crypto/curve25519": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto/ed25519?go-get=1
Parsing meta tags from https://golang.org/x/crypto/ed25519?go-get=1 (status code 200)
get "golang.org/x/crypto/ed25519": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/ed25519?go-get=1
get "golang.org/x/crypto/ed25519": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto/ed25519/internal/edwards25519?go-get=1
Parsing meta tags from https://golang.org/x/crypto/ed25519/internal/edwards25519?go-get=1 (status code 200)
get "golang.org/x/crypto/ed25519/internal/edwards25519": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/ed25519/internal/edwards25519?go-get=1
get "golang.org/x/crypto/ed25519/internal/edwards25519": verifying non-authoritative meta tag
Fetching https://golang.org/x/crypto/poly1305?go-get=1
Parsing meta tags from https://golang.org/x/crypto/poly1305?go-get=1 (status code 200)
get "golang.org/x/crypto/poly1305": found meta tag get.metaImport{Prefix:"golang.org/x/crypto", VCS:"git", RepoRoot:"https://go.googlesource.com/crypto"} at https://golang.org/x/crypto/poly1305?go-get=1
get "golang.org/x/crypto/poly1305": verifying non-authoritative meta tag
Fetching https://k8s.io/client-go/kubernetes?go-get=1
Parsing meta tags from https://k8s.io/client-go/kubernetes?go-get=1 (status code 200)
get "k8s.io/client-go/kubernetes": found meta tag get.metaImport{Prefix:"k8s.io/client-go", VCS:"git", RepoRoot:"https://github.com/kubernetes/client-go"} at https://k8s.io/client-go/kubernetes?go-get=1
get "k8s.io/client-go/kubernetes": verifying non-authoritative meta tag
Fetching https://k8s.io/client-go?go-get=1
Parsing meta tags from https://k8s.io/client-go?go-get=1 (status code 200)
k8s.io/client-go (download)
Fetching https://k8s.io/client-go/discovery?go-get=1
Parsing meta tags from https://k8s.io/client-go/discovery?go-get=1 (status code 200)
get "k8s.io/client-go/discovery": found meta tag get.metaImport{Prefix:"k8s.io/client-go", VCS:"git", RepoRoot:"https://github.com/kubernetes/client-go"} at https://k8s.io/client-go/discovery?go-get=1
get "k8s.io/client-go/discovery": verifying non-authoritative meta tag
github.com/golang/protobuf (download)
github.com/googleapis/gnostic (download)
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", RepoRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
Fetching https://k8s.io/apimachinery/pkg/api/errors?go-get=1
Parsing meta tags from https://k8s.io/apimachinery/pkg/api/errors?go-get=1 (status code 200)
get "k8s.io/apimachinery/pkg/api/errors": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at https://k8s.io/apimachinery/pkg/api/errors?go-get=1
get "k8s.io/apimachinery/pkg/api/errors": verifying non-authoritative meta tag
Fetching https://k8s.io/apimachinery?go-get=1
Parsing meta tags from https://k8s.io/apimachinery?go-get=1 (status code 200)
k8s.io/apimachinery (download)
Fetching https://k8s.io/apimachinery/pkg/apis/meta/v1?go-get=1
Parsing meta tags from https://k8s.io/apimachinery/pkg/apis/meta/v1?go-get=1 (status code 200)
get "k8s.io/apimachinery/pkg/apis/meta/v1": found meta tag get.metaImport{Prefix:"k8s.io/apimachinery", VCS:"git", RepoRoot:"https://github.com/kubernetes/apimachinery"} at https://k8s.io/apimachinery/pkg/apis/meta/v1?go-get=1

.. .. 解析来自https://k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1?go-get=1 的元标记(状态码 200) .. ..

Fetching https://k8s.io/test-infra/kubetest/process?go-get=1
Parsing meta tags from https://k8s.io/test-infra/kubetest/process?go-get=1 (status code 200)
get "k8s.io/test-infra/kubetest/process": found meta tag get.metaImport{Prefix:"k8s.io/test-infra", VCS:"git", RepoRoot:"https://github.com/kubernetes/test-infra"} at https://k8s.io/test-infra/kubetest/process?go-get=1
get "k8s.io/test-infra/kubetest/process": verifying non-authoritative meta tag
Fetching https://k8s.io/test-infra/kubetest/util?go-get=1
Parsing meta tags from https://k8s.io/test-infra/kubetest/util?go-get=1 (status code 200)
get "k8s.io/test-infra/kubetest/util": found meta tag get.metaImport{Prefix:"k8s.io/test-infra", VCS:"git", RepoRoot:"https://github.com/kubernetes/test-infra"} at https://k8s.io/test-infra/kubetest/util?go-get=1
get "k8s.io/test-infra/kubetest/util": verifying non-authoritative meta tag
Fetching https://k8s.io/test-infra/kubetest/kind?go-get=1
Parsing meta tags from https://k8s.io/test-infra/kubetest/kind?go-get=1 (status code 200)
get "k8s.io/test-infra/kubetest/kind": found meta tag get.metaImport{Prefix:"k8s.io/test-infra", VCS:"git", RepoRoot:"https://github.com/kubernetes/test-infra"} at https://k8s.io/test-infra/kubetest/kind?go-get=1
get "k8s.io/test-infra/kubetest/kind": verifying non-authoritative meta tag
Fetching https://k8s.io/test-infra/kubetest/kubeadmdind?go-get=1
Parsing meta tags from https://k8s.io/test-infra/kubetest/kubeadmdind?go-get=1 (status code 200)
get "k8s.io/test-infra/kubetest/kubeadmdind": found meta tag get.metaImport{Prefix:"k8s.io/test-infra", VCS:"git", RepoRoot:"https://github.com/kubernetes/test-infra"} at https://k8s.io/test-infra/kubetest/kubeadmdind?go-get=1
get "k8s.io/test-infra/kubetest/kubeadmdind": verifying non-authoritative meta tag

chan@coe-OptiPlex-3060:~$ kubetest --extract=v1.13.0 kubetest:找不到命令

【问题讨论】:

  • 该目录中的README.md 文件似乎链接到一些相当广泛的文档。你有什么问题?
  • 嗨,David Maze,我正在寻找主要脚本名称。这样我就可以使用 go run 命令运行 go 脚本。我也在寻找任何其他方法来执行端到端一致性测试。

标签: go kubernetes


【解决方案1】:

按照下面提到的步骤:

安装 Go

wget https://dl.google.com/go/go1.12.1.linux-amd64.tar.gz

sudo tar -C /usr/local -xzf go1.12.1.linux-amd64.tar.gz
export GOPATH="/home/vagrant/go"
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin

安装 kubetest

go get -v -u k8s.io/test-infra/kubetest

提取版本

kubetest --extract=v1.13.0

cd kubernetes

针对本地集群进行测试

export KUBECONFIG=/path/to/kubeconfig
export KUBE_MASTER_IP="http://127.0.0.1:<PORT>"
export KUBE_MASTER_IP="127.0.0.1:<PORT>"
export KUBE_MASTER=local



kubetest --test --provider=skeleton --test_args="--ginkgo.focus=\[Conformance\]" | tee test.out

【讨论】:

  • 感谢 Prakash 提供的详细信息。我尝试安装 kubetest,但它抛出的状态码为 200。我在这篇文章的描述部分提到了日志。
  • 这些确实是文档化的说明。但是,文档说明不起作用,即使对于 1.13。祝一切顺利。
  • 这是 Udemy 课程中的当前问题; e2e以前是这样安装的,现在没有。
【解决方案2】:

这对我有用,不确定是否所有步骤都是必要的:

# get kubetest, ginkgo and gomega

go get -u k8s.io/test-infra/kubetest
go get github.com/onsi/ginkgo/ginkgo
go get github.com/onsi/gomega/...

# Install Google SDK: https://cloud.google.com/sdk/docs/downloads-versioned-archives
# Login into Google Developer Cloud, necessary to fetch kubetest binaries with extract command

gcloud auth login

# Get the binaries
# WARNING: it removes all directories with kubernetes in the name (weird), it removed my kubernetes-the-hard-way repo, thus better switch to an empty dir before proceeding
kubetest --extract=v1.18.2
cd kubernetes

# Get the kubernetes client config
# I am using my own setup to deploy k8s using ansible/kubeadm here: https://github.com/earthquakesan/kubernetes-the-hard-way
# simply go into vagrant/, then do vagrant up
# after VMs are up, follow the 18-kubeadm.md guide

scp master-1:/home/vagrant/.kube/config ./

# Finally run the tests

export KUBECONFIG=$(pwd)/config
export KUBE_MASTER_IP=192.168.5.30:6443
export KUBE_MASTER_URL=https://192.168.5.30:6443
export KUBE_MASTER=master-1
export KUBERNETES_PROVIDER=skeleton
kubetest --test --test_args="--ginkgo.focus=\[Conformance\]" > test.out

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-03-02
    • 2021-06-29
    • 2020-04-18
    • 1970-01-01
    • 2020-03-23
    • 2018-06-04
    • 2021-12-08
    • 1970-01-01
    相关资源
    最近更新 更多