我如何在本地群集中获取minikube节点 [英] how do i get the minikube nodes in a local cluster

查看:173
本文介绍了我如何在本地群集中获取minikube节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用VM和minikube设置本地集群,因为ID一直在读取只能用于本地目的的集群,但是id喜欢加入辅助计算机,并且我正在寻找一种创建联接和哈希的方法

Im trying to set up a local cluster using VM and minikube, as Id been reading its only possible to use it for local purposes, but id like to join a secondary machine, and im searching a way to create the join and hash.

推荐答案

如果您的minikube计算机正在使用VirtualBox,则可以轻松实现.

You can easily do it in case your minikube machine is using VirtualBox.

  1. 启动迷你库:

  1. Start the minikube:

$ minikube start --vm-driver="virtualbox"

  • 在minikube中检查kubeadm,kubelet和kubectl的版本并打印连接命令:

  • Check the versions of kubeadm, kubelet and kubectl in minikube and print join command:

    $ kubectl version
    
    $ minikube ssh
    $ kubelet --version
    $ kubeadm token create --print-join-command
    

  • 在VirtualBox中创建新的VM.我已经使用Vagrant为该测试创建Ubuntu 16lts VM.检查minikube和新VM是否在同一主机专用VM网络中. 您可以使用最适合您的任何东西,但是对于不同的Linux发行版,软件包的安装过程将有所不同.

  • Create a new VM in VirtualBox. I've used Vagrant to create Ubuntu 16lts VM for this test. Check that the minikube and the new VM are in the same host-only VM network. You can use anything that suits you best, but the packages installation procedure would be different for different Linux distributions.

    (在新的VM上.)使用Kubernetes添加存储库:

    (On the new VM.) Add repository with Kubernetes:

    $ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
    $ cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
    deb http://apt.kubernetes.io/ kubernetes-xenial main
    EOF
    $ apt-get update
    

  • (在新VM上.)在新VM上安装相同版本的kubelet kubeadm和其他工具(在我的情况下为1.10.0)

  • (On the new VM.)Install the same version of kubelet kubeadm and other tools on the new VM (1.10.0 in my case)

    $ apt-get -y install ebtables ethtool docker.io apt-transport-https kubelet=1.10.0-00 kubeadm=1.10.0-00
    

  • (在新VM上.)使用步骤2中的join命令.IP地址应来自VM Host-Only-Network.在我的情况下,只有Nat网络无法正常运行.

  • (On the new VM.)Use your join command from the step 2. IP address should be from the VM Host-Only-Network. Only having Nat networks didn't work well in my case.

    $ kubeadm join 192.168.xx.yy:8443 --token asdfasf.laskjflakflsfla --discovery-token-ca-cert-hash sha256:shfkjshkfjhskjfskjdfhksfh...shdfk
    

  • (在主主机上)将网络解决方案添加到群集:

  • (On the main host) Add network solution to the cluster:

    $ kubectl apply -f https://docs.projectcalico.org/v3.0/getting-started/kubernetes/installation/hosted/kubeadm/1.7/calico.yaml
    

  • (在主主机上)使用kubectl检查您的节点和Pod:

  • (On the main host) Check your nodes and pods using kubectl:

    $ kubectl get nodes:
    
    NAME            STATUS    ROLES     AGE       VERSION
    minikube        Ready     master    1h        v1.10.0
    ubuntu-xenial   Ready     <none>    36m       v1.10.0
    
    $ kubectl get pods --all-namespaces -o wide
    NAMESPACE     NAME                                       READY     STATUS    RESTARTS   AGE       IP           NODE
    kube-system   calico-etcd-982l8                          1/1       Running   0          10m       10.0.2.15    minikube
    kube-system   calico-kube-controllers-79dccdc4cc-66zxm   1/1       Running   0          10m       10.0.2.15    minikube
    kube-system   calico-node-9sgt5                          1/2       Running   13         10m       10.0.2.15    ubuntu-xenial
    kube-system   calico-node-qtpg2                          2/2       Running   0          10m       10.0.2.15    minikube
    kube-system   etcd-minikube                              1/1       Running   0          1h        10.0.2.15    minikube
    kube-system   heapster-6hmhs                             1/1       Running   0          1h        172.17.0.4   minikube
    kube-system   influxdb-grafana-69s5s                     2/2       Running   0          1h        172.17.0.5   minikube
    kube-system   kube-addon-manager-minikube                1/1       Running   0          1h        10.0.2.15    minikube
    kube-system   kube-apiserver-minikube                    1/1       Running   0          1h        10.0.2.15    minikube
    kube-system   kube-controller-manager-minikube           1/1       Running   0          1h        10.0.2.15    minikube
    kube-system   kube-dns-86f4d74b45-tzc4r                  3/3       Running   0          1h        172.17.0.2   minikube
    kube-system   kube-proxy-vl5mq                           1/1       Running   0          1h        10.0.2.15    minikube
    kube-system   kube-proxy-xhv8s                           1/1       Running   2          35m       10.0.2.15    ubuntu-xenial
    kube-system   kube-scheduler-minikube                    1/1       Running   0          1h        10.0.2.15    minikube
    kube-system   kubernetes-dashboard-5498ccf677-7gf4j      1/1       Running   0          1h        172.17.0.3   minikube
    kube-system   storage-provisioner                        1/1       Running   0          1h        10.0.2.15    minikube
    

  • 这篇关于我如何在本地群集中获取minikube节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆