k8s遇坑:The connection to the server k8s-api.virtual.local:6443 was refused - did you specify the right host or port?


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就不報錯了

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM