zoukankan      html  css  js  c++  java
  • k8s的worker node节点运行kubectl报错:The connection to the server localhost:8080 was refused

    一、现象

    [root@redis-01 kubernetes]# kubectl get pods
    The connection to the server localhost:8080 was refused - did you specify the right host or port?
    [root@redis-01 kubernetes]# 

    二、原因

    kubectl运行需要使用kubernetes-admin来运行

    三、解决

    1、将master节点的/etc/kubernetes/admin.conf复制从node节点的/etc/kubernetes目录下

    [root@master69 kubernetes]# scp -P25601 admin.conf root@172.28.5.120:/etc/kubernetes/

    2、配置环境变量KUBECONFIG

    [root@redis-01 kubernetes]# echo "export KUBECONFIG=/etc/kubernetes/admin.conf">>/etc/profile
    [root@redis-01 kubernetes]# source /etc/profile
    [root@redis-01 kubernetes]# echo $KUBECONFIG
    /etc/kuberbetes/admin.conf

    3、执行验证

    [root@redis-01 kubernetes]# kubectl get pods -n kube-system
    NAME                                READY   STATUS             RESTARTS   AGE
    etcd-localhost                      1/1     Running            0          46h
    kube-apiserver-localhost            1/1     Running            0          11h
    kube-controller-manager-localhost   1/1     Running            3          46h
    kube-flannel-ds-8bx7f               1/1     Running            0          42h
    kube-flannel-ds-drfqk               1/1     Running            0          41h
    kube-flannel-ds-hx4tk               1/1     Running            0          41h
    kube-flannel-ds-spl2l               1/1     Running            0          46h
    kube-proxy-2564b                    1/1     Running            0          41m
    kube-proxy-jltvv                    1/1     Running            0          41m
    kube-proxy-kdv62                    1/1     Running            0          41m
    kube-proxy-slgcq                    1/1     Running            1          41m
    kube-scheduler-localhost            1/1     Running            3          46h
  • 相关阅读:
    51nod 1081 子段求和
    51nod 1085 背包问题
    51nod 1012 最小公倍数LCM
    51nod 1046 A^B Mod C
    51nod 1057 N的阶乘
    死锁 必然
    two-sum
    一些基本定义
    常用命令
    python_99_面向对象多态
  • 原文地址:https://www.cnblogs.com/sky-cheng/p/14239549.html
Copyright © 2011-2022 走看看