k8s遇坑:The connection to the server k8s-api.virtual.local:6443 was refused - did you specify the righ

Posted 努力乄小白

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了k8s遇坑:The connection to the server k8s-api.virtual.local:6443 was refused - did you specify the righ相关的知识,希望对你有一定的参考价值。

k8s坑The connection to the server localhost:8080 was refused - did you specify the right host or port
2019年01月08日 17:21:06 金柱 阅读数:47

定义一个mysql的RC文件:mysql-rc.yaml

apiVersion: v1
kind: ReplicationController
metadata:
  name: mysql
spec:
  replicas: 1
  selector:
    app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - name: mysql
        image: mysql
        ports:
        - containerPort: 3306
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: "123456"



发布到k8s集群中

# kubectl create -f mysql-rc.yaml

    1
    2

报错:

The connection to the server localhost:8080 was refused - did you specify the right host or port?

    1
    2

没有启动k8s集群或启动顺序不对,重新按一下顺序启动所有服务:

# systemctl start etcd
# systemctl start docker
# systemctl start kube-apiserver
# systemctl start kube-controller-manager
# systemctl start kube-scheduler
# systemctl start kubelet
# systemctl start kube-proxy



然后再发布mysql-rc.yaml就不报错了

 

以上是关于k8s遇坑:The connection to the server k8s-api.virtual.local:6443 was refused - did you specify the righ的主要内容,如果未能解决你的问题,请参考以下文章

Nagios-报错:UNKNOWN Can't connect to the JVM:

Can't connect to X11 window server using ':1.0' as the value of the DISPLAY variable.(示例

CentOS8安装pycharm报错Can't connect to X11 window server using ':0' as the value of the DIS(

Couldn‘t connect to session bus: Did not receive a reply. Possible causes include: the remote applic

The connection to adb is down, and a severe error has occured. Android ADB server didn't ACK *

svn连接提示can't connect to the host'***':由于目标机积极拒绝,无法连接。