用户"系统"无法列出群集中的所有服务

时间:2016-11-03 13:29:36

标签: authentication permissions openshift

我是openshift的新手。我正在尝试完成一些基本的安装选项。首先,我能够下载并运行流浪者图像。当我这样做时,我能够登录并看到几个项目和容器正在运行。接下来我尝试了二进制安装。所以我下载了openshift origin服务器v1.3.1解开它并运行以下内容:

sudo openshift start

似乎openshift开始了,但我确实注意到输出中的一些可疑行如下:

W1103 09:06:47.360850    4647 start_master.go:272] Warning: assetConfig.loggingPublicURL: Invalid value: "": required to view aggregated container
 logs in the console, master start will continue.
W1103 09:06:47.360906    4647 start_master.go:272] Warning: assetConfig.metricsPublicURL: Invalid value: "": required to view cluster metrics in t
he console, master start will continue.
E1103 09:06:47.373823    4647 cacher.go:220] unexpected ListAndWatch error: pkg/storage/cacher.go:163: Failed to list *api.ClusterPolicy: client:
etcd cluster is unavailable or misconfigured
E1103 09:06:47.374026    4647 cacher.go:220] unexpected ListAndWatch error: pkg/storage/cacher.go:163: Failed to list *api.ClusterPolicyBinding: c
lient: etcd cluster is unavailable or misconfigured
E1103 09:06:47.374102    4647 cacher.go:220] unexpected ListAndWatch error: pkg/storage/cacher.go:163: Failed to list *api.PolicyBinding: client:
etcd cluster is unavailable or misconfigured
E1103 09:06:47.374254    4647 cacher.go:220] unexpected ListAndWatch error: pkg/storage/cacher.go:163: Failed to list *api.Group: client: etcd clu
ster is unavailable or misconfigured
E1103 09:06:47.374420    4647 cacher.go:220] unexpected ListAndWatch error: pkg/storage/cacher.go:163: Failed to list *api.Policy: client: etcd cl
uster is unavailable or misconfigured
E1103 09:06:47.376485    4647 reflector.go:203] github.com/openshift/origin/vendor/k8s.io/kubernetes/plugin/pkg/admission/limitranger/admission.go
:154: Failed to list *api.LimitRange: Get https://XXX.XXX.XXX.XXX:8443/api/v1/limitranges?resourceVersion=0: dial tcp XXX.XXX.XXX.XXX:8443: getsockopt:
connection refused

服务器启动后我可以登录,但系统用户似乎没有权限做很多事情。例如,系统用户无法查看群集中的任何项目或服务。运行某些 oc 命令似乎表明系统用户没有适当的权限,如下所示:

 #./oc login https://localhost:8443 Authentication required for https://localhost:8443 (openshift) Username: system Password: Login
 successful.

 You don't have any projects. You can try to create a new project, by
 running

     oc new-project <projectname>

 # ./oc new-project default 
 Error from server: project "default" already exists
 # ./oc get services --all-namespaces 
 User "system" cannot list all services in the cluster

似乎我必须遗漏一些关于如何从二进制发行版中启动openshift的基本内容。我在文档中找不到任何与此问题相关的内容。

2 个答案:

答案 0 :(得分:2)

不确定您的环境是什么样的,因此以下内容可能无法100%运行。

但你可以尝试以下方法:

oc whoami
oc login -u system:admin
oc whoami

系统:管理员帐户是您的root帐户,您可以从他们创建其他用户帐户。

我发现运行OpenShift开发实例的最佳方法是通过oc cluster up。 https://github.com/openshift/origin/blob/master/docs/cluster_up_down.md。这在docker的openshift上运行容器化版本。可能值得一试,因为您以前的安装方法似乎有一些错误。

答案 1 :(得分:1)

如果你想手动完成这项工作(如上所述没有oc群集)

export KUBECONFIG=/full/path/to/openshift.local.config/master/admin.kubeconfig

sudo chmod a+rwX -R /path/to/openshift.local.config/

oadm policy add-cluster-role-to-user cluster-admin demo (demigod mode)

oc whoami 
system:admin

oc projects
You have access to the following projects and can switch between them with 'oc project <projectname>':

    default
    kube-system
    openshift
    openshift-infra
  * test

这不是一个生产设置,这只是为了搞乱。

p.s。:忽略错误的clusterbinding策略错误,问题已知并且不会影响您登录。<​​/ p>