• Mac016--安装kubernetes(k8s)


    一。安装kubernetes(k8s)

    参考:

    http://batizhao.github.io/2018/01/18/Running-Kubernetes-Locally-via-Minikube/

    https://www.kubernetes.org.cn/installkubectl

    使用Kubernetes命令行工具kubectl在Kubernetes上部署和管理应用程序。使用kubectl,可以检查集群资源; 创建,删除和更新组件。

    准备工作

    说明:安装 xhyve 驱动程序。此处可以不用安装,因为事先快已安装visualBox。

    Step1:安装 kubectl

    $ curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/darwin/amd64/kubectl
    
    $ chmod +x ./kubectl
    $ sudo mv ./kubectl /usr/local/bin/kubectl
    
    $ kubectl version
    Client Version: version.Info{Major:"1", Minor:"9", GitVersion:"v1.9.1", GitCommit:"3a1c9449a956b6026f075fa3134ff92f7d55f812", GitTreeState:"clean", BuildDate:"2018-01-04T11:52:23Z", GoVersion:"go1.9.2", Compiler:"gc", Platform:"darwin/amd64"}
    Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}

    Step2:安装 Minikube

    $ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.1/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/
    
    $ minikube version
    minikube version: v0.24.1

    启动集群

    $ minikube start

    查看节点

    $ kubectl get node

    出现问题:

    效果:

    详细命令 & 错误点 记录:

    //Step1:进入kube
    $ cd .kube/
    
    //Step2:查看配置文件
    $ vim config
    
    ######################
    tcp4      31      0  10.0.56.39.63785       106.39.162.247.443     CLOSE_WAIT 
    tcp4     273      0  10.0.56.39.63783       211.90.25.49.443       CLOSE_WAIT 
    tcp4     273      0  10.0.56.39.63782       211.90.25.49.443       CLOSE_WAIT 
    tcp4      31      0  10.0.56.39.63781       211.90.25.49.443       CLOSE_WAIT 
    tcp4       0      0  10.0.56.39.63753       117.121.101.40.443     ESTABLISHED
    tcp4       0      0  10.0.56.39.63749       58.83.206.244.443      ESTABLISHED
    tcp4       0      0  10.0.56.39.63611       172.20.39.2.443        ESTABLISHED
    tcp4       0      0  10.0.56.39.59936       101.226.211.105.443    ESTABLISHED
    udp4       0      0  10.0.56.39.62453       172.217.161.170.443               
    udp4       0      0  10.0.56.39.56490       216.58.197.98.443                 
    udp4       0      0  10.0.56.39.61143       172.217.24.35.443                 
    udp4       0      0  10.0.56.39.65372       74.125.203.94.443      
    ######################
    
    //Step3
    $ ps -ef | grep mini
    
    ################
    0   303     1   0 Fri02PM ??         0:00.23 /System/Library/PrivateFrameworks/SystemAdministration.framework/XPCServices/writeconfig.xpc/Contents/MacOS/writeconfig
    47124082 23049 23022   0  4:25PM ??         3:20.07 /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless --comment minikube --startvm eafceda8-1504-4cf4-8a83-2b7b20dd03c1 --vrde config
    47124082 23216 22367   0  4:36PM ttys001    0:00.00 grep mini
    #################
    
    //Step4:
    $ minikube status
    
    #####################
    minikube: Running
    cluster: Running
    kubectl: Correctly Configured: pointing to minikube-vm at 192.168.99.100
    ####################
    
    //Step5:
    $ kubectl
    
    #####################
    kubectl controls the Kubernetes cluster manager. 
    
    Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/ ...
    #####################
    
    //Step6:
    $ which kubectl
    
    #######################
    /usr/local/bin/kubectl
    #######################
    
    //Step7:
    $ find / -name kubectl
    
    //Step8:
    $ apt-get
     
    #######################
    -bash: apt-get: command not found
    #######################
    
    //Step9:
    $ kubectl get node
    
    #######################
    No resources found.
    #######################
    
    //Step10:
    $ kubectl --version
    
    #######################
    Error: unknown flag: --version
    #######################

    解决方案:

    //Step1:
    ZBMAC:.kube shiyufeng$ brew install wget
    
    //Step2:
    ZBMAC:.kube shiyufeng$ wget https://storage.googleapis.com/kubernetes-release/release/v1.8.7/bin/darwin/amd64/kubectl
    
    //Step3:
    ZBMAC:.kube shiyufeng$ chmod +x kubectl 
    
    //Step4:
    ZBMAC:.kube shiyufeng$ ./kubectl get nodes
    
    ###############################
    NAME       STATUS    ROLES     AGE       VERSION
    minikube   Ready     <none>    18m       v1.8.0
    ################################
    
    //OK
    
    //Step5:
    ZBMAC:.kube shiyufeng$ which kubectl
    /usr/local/bin/kubectl
    
    //Step6:
    ZBMAC:.kube shiyufeng$ mv kubectl /usr/local/bin/
    
    //Step7:
    ZBMAC:.kube shiyufeng$ kubectl version
    Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.7", GitCommit:"b30876a5539f09684ff9fde266fda10b37738c9c", GitTreeState:"clean", BuildDate:"2018-01-16T21:59:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
    Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"0b9efaeb34a2fc51ff8e4d34ad9bc6375459c4a4", GitTreeState:"clean", BuildDate:"2017-11-29T22:43:34Z", GoVersion:"go1.9.1", Compiler:"gc", Platform:"linux/amd64"}
    
    //Step7:
    ZBMAC:.kube shiyufeng$ kubectl get nodes
    NAME       STATUS    ROLES     AGE       VERSION
    minikube   Ready     <none>    18m       v1.8.0
    
    //Step8:
    ZBMAC:.kube shiyufeng$ kubectl get pods --all-namespaces
    NAMESPACE     NAME                          READY     STATUS    RESTARTS   AGE
    kube-system   kube-addon-manager-minikube   1/1       Running   0          19m
    kube-system   kube-dns-86f6f55dd5-t9f5x     3/3       Running   0          19m
    kube-system   kubernetes-dashboard-mxfd7    1/1       Running   1          19m
    kube-system   storage-provisioner           1/1       Running   0          19m

    k8s安装完成!

  • 相关阅读:
    用于 Visual Studio 和 ASP.NET 的 Web 应用程序项目部署常见问题
    django 之知识点总结以及Form组件
    HTTP协议详细介绍
    分页和中间件
    用户认证--------------auth模块
    关于查询知识点总结
    cookie和session
    django之跨表查询及添加记录
    django之数据库表的单表查询
    django之ORM数据库操作
  • 原文地址:https://www.cnblogs.com/kaixinyufeng/p/9255184.html
Copyright © 2020-2023  润新知