Ubuntu oc集群can';由于缺少~/.kube/config,无法启动kube apiserver
我尝试在我的桌面上运行OKD(Ubuntu 18)。我遵照指示:()Ubuntu oc集群can';由于缺少~/.kube/config,无法启动kube apiserver,ubuntu,kubernetes,openshift,openshift-client-tools,okd,Ubuntu,Kubernetes,Openshift,Openshift Client Tools,Okd,我尝试在我的桌面上运行OKD(Ubuntu 18)。我遵照指示:() 我已安装Docker: 不安全的注册表: 重新启动Docker deamon: 已禁用防火墙: 下载的OKD客户端工具: oc和kubectl来自 我尝试启动群集,但失败了 漫长的等待和之后: E1104 16:59:58.864017 6317 run_self_hosted.go:571] API server error: Get https://127.0.0.1:8443/healthz?timeout=32s
oc
和kubectl
来自
E1104 16:59:58.864017 6317 run_self_hosted.go:571] API server error: Get https://127.0.0.1:8443/healthz?timeout=32s: dial tcp 127.0.0.1:8443: connect: connection refused ()
Error: timed out waiting for the condition
使用更高的日志级别(我知道我必须删除
openshift.local.clusterup
目录,或者在我想要刷新oc cluster up
时传递--base dir
):
我试图检查什么是错误的,我注意到缺少配置的问题
$ ./oc cluster status
Error: invalid configuration: Missing or incomplete configuration info. Please login or point to an existing, complete config file:
1. Via the command-line flag --config
2. Via the KUBECONFIG environment variable
3. In your home directory as ~/.kube/config
To view or setup config directly use the 'config' command.
我没有环境变量:
$ echo $KUBECONFIG
我没有~/.kube/config
文件:
$ cat ~/.kube/config
cat: /home/my-username/.kube/config: No such file or directory
$ ls ~/.kube/
ls: cannot access '/home/my-username/.kube/': No such file or directory
我知道,oc cluster up
应该创建~/.kube/config
但在我的情况下,它不会产生任何影响。
由于缺少配置,即使是
kubectl
也无法工作(我认为它应该可以从二进制文件中使用典型的kubectl安装):
我解决了这个问题
我有禁用防火墙(ufw)的Ubuntu。但iptables仍然有效
命令sudo iptables-L
向我显示了许多规则,其中包括以下四条:
Chain KUBE-SERVICES (1 references)
target prot opt source destination
REJECT tcp -- anywhere 172.30.237.36 /* default/router:80-tcp has no endpoints */ tcp dpt:http reject-with icmp-port-unreachable
REJECT tcp -- anywhere 172.30.1.1 /* default/docker-registry:5000-tcp has no endpoints */ tcp dpt:5000 reject-with icmp-port-unreachable
REJECT tcp -- anywhere 172.30.237.36 /* default/router:443-tcp has no endpoints */ tcp dpt:https reject-with icmp-port-unreachable
REJECT tcp -- anywhere 172.30.237.36 /* default/router:1936-tcp has no endpoints */ tcp dpt:1936 reject-with icmp-port-unreachable
我不知道他们从哪里来(我可以猜-下面)。我决定删除它
sudo iptables -L --line-numbers
sudo iptables -D KUBE-SERVICES 1
sudo iptables -D KUBE-SERVICES 1
sudo iptables -D KUBE-SERVICES 1
sudo iptables -D KUBE-SERVICES 1
并重新启动系统(确保重新加载iptables)
在/oc集群启动后
将启动并创建~/.kube/config
Server Information ...
OpenShift server started.
The server is accessible via web console at:
https://127.0.0.1:8443
我猜规则可能来自于
oc cluster up
,当我在开始时运行它一次,而不添加“不安全的注册表”:[“172.30.0.0/16”]
到/etc/docker/daemon.json
(我试图检查这是否是强制性的)
$ ./oc cluster up --loglevel=5
...
I1104 17:07:50.991364 14512 run_self_hosted.go:181] Waiting for the kube-apiserver to be ready
I1104 17:07:50.992053 14512 run_self_hosted.go:557] Server isn't healthy yet. Waiting a little while. Get https://127.0.0.1:8443/healthz?timeout=32s: dial tcp 127.0.0.1:8443: connect: connection refused
I1104 17:07:51.992467 14512 run_self_hosted.go:557] Server isn't healthy yet. Waiting a little while. Get https://127.0.0.1:8443/healthz?timeout=32s: dial tcp 127.0.0.1:8443: connect: connection refused
I1104 17:07:52.993484 14512 run_self_hosted.go:557] Server isn't healthy yet. Waiting a little while. Get https://127.0.0.1:8443/healthz?timeout=32s: dial tcp 127.0.0.1:8443: connect: connection refused
...
I1104 17:08:10.992682 14512 run_self_hosted.go:557] Server isn't healthy yet. Waiting a little while. Get https://127.0.0.1:8443/healthz?timeout=32s: net/http: TLS handshake timeout
...
error: unable to recognize "/namespace.yaml": Get https://127.0.0.1:8443/api?timeout=32s: dial tcp 127.0.0.1:8443: connect: connection refused
...
The connection to the server 127.0.0.1:8443 was refused - did you specify the right host or port?
...
E1104 17:08:52.435348 14512 interface.go:34] Failed to install "openshift-service-cert-signer-operator": failed to install "openshift-service-cert-signer-operator": cannot create container using image openshift/origin-cli:v3.11; caused by: cannot create container using image openshift/origin-cli:v3.11
E1104 17:08:53.087022 14512 interface.go:34] Failed to install "kube-dns": failed to install "kube-dns": cannot create container using image openshift/origin-cli:v3.11; caused by: cannot create container using image openshift/origin-cli:v3.11
I1104 17:08:53.087047 14512 interface.go:41] Finished installing "kube-proxy" "kube-dns" "openshift-service-cert-signer-operator" "openshift-apiserver"
Error: [failed to install "kube-proxy": cannot create container using image openshift/origin-cli:v3.11; caused by: cannot create container using image openshift/origin-cli:v3.11, failed to install "openshift-apiserver": cannot create container using image openshift/origin-cli:v3.11; caused by: cannot create container using image openshift/origin-cli:v3.11, failed to install "openshift-service-cert-signer-operator": cannot create container using image openshift/origin-cli:v3.11; caused by: cannot create container using image openshift/origin-cli:v3.11, failed to install "kube-dns": cannot create container using image openshift/origin-cli:v3.11; caused by: cannot create container using image openshift/origin-cli:v3.11]
$ ./oc cluster status
Error: invalid configuration: Missing or incomplete configuration info. Please login or point to an existing, complete config file:
1. Via the command-line flag --config
2. Via the KUBECONFIG environment variable
3. In your home directory as ~/.kube/config
To view or setup config directly use the 'config' command.
$ echo $KUBECONFIG
$ cat ~/.kube/config
cat: /home/my-username/.kube/config: No such file or directory
$ ls ~/.kube/
ls: cannot access '/home/my-username/.kube/': No such file or directory
$ ./kubectl version --client
error: no configuration has been provided
$ ./kubectl config view
apiVersion: v1
clusters: []
contexts: []
current-context: ""
kind: Config
preferences: {}
users: []
Chain KUBE-SERVICES (1 references)
target prot opt source destination
REJECT tcp -- anywhere 172.30.237.36 /* default/router:80-tcp has no endpoints */ tcp dpt:http reject-with icmp-port-unreachable
REJECT tcp -- anywhere 172.30.1.1 /* default/docker-registry:5000-tcp has no endpoints */ tcp dpt:5000 reject-with icmp-port-unreachable
REJECT tcp -- anywhere 172.30.237.36 /* default/router:443-tcp has no endpoints */ tcp dpt:https reject-with icmp-port-unreachable
REJECT tcp -- anywhere 172.30.237.36 /* default/router:1936-tcp has no endpoints */ tcp dpt:1936 reject-with icmp-port-unreachable
sudo iptables -L --line-numbers
sudo iptables -D KUBE-SERVICES 1
sudo iptables -D KUBE-SERVICES 1
sudo iptables -D KUBE-SERVICES 1
sudo iptables -D KUBE-SERVICES 1
Server Information ...
OpenShift server started.
The server is accessible via web console at:
https://127.0.0.1:8443