kubernetes(八)二进制安装-集群简单验证

2021-03-30 16:25

阅读:501

YPE html>

标签:The   schedule   ble   image   docke   pps   available   further   his   

验证集群功能(在master节点上执行)

以一个nginx的service和deployment来验证集群功能

  1. 创建启动文件

    mkdir /opt/k8s/yml
    
    cd /opt/k8s/yml
    
    cat > nginx.yml 
  2. 启动服务

    kubectl create -f nginx.yml
    
    
    • 第一次启动时需要下载k8s.gcr.io/pause:3.1镜像,国内无法直接下载,造成服务无法启动,通过下面操作来解决

      docker pull kubeimage/pause:3.1
      docker tag kubeimage/pause:3.1 k8s.gcr.io/pause:3.1 
      
      
  3. 观察服务启动情况

    
    root@master:/opt/k8s/yml# kubectl get service -o wide
    NAME         TYPE        CLUSTER-IP    EXTERNAL-IP   PORT(S)       AGE   SELECTOR
    kubernetes   ClusterIP   10.254.0.1            443/TCP       41h   
    nginx        NodePort    10.254.8.25           80:8080/TCP   30m   app=nginx
    root@master:/opt/k8s/yml# kubectl get pod -o wide
    NAME                                READY   STATUS    RESTARTS   AGE   IP            NODE    NOMINATED NODE   READINESS GATES
    nginx-deployment-56f8998dbc-955gf   1/1     Running   0          30m   172.30.78.2   slave   
    root@master:/opt/k8s/yml# curl http://192.168.0.114:8080
    Welcome to nginx!
    
    

    Welcome to nginx!

    If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

    For online documentation and support please refer to nginx.org.
    Commercial support is available at nginx.com.

    Thank you for using nginx.

遇到问题

  1. k8s组件 kube-scheduler服务停掉,造成所有的pod都处于pending状态,没有任何events信息
  2. k8s组件kube-controller-manager服务停掉,造成所有的rs、rc都不创建,对应的deployment中没有任何events信息,NewReplicats

kubernetes(八)二进制安装-集群简单验证

标签:The   schedule   ble   image   docke   pps   available   further   his   

原文地址:https://www.cnblogs.com/gaofeng-henu/p/12594637.html


评论


亲,登录后才可以留言!