gpt4 book ai didi

kubernetes - 如何在Windows 10上迁移Kubeconfig

转载 作者:行者123 更新时间:2023-12-02 12:29:50 29 4
gpt4 key购买 nike

我已经尝试安装minikube两天了。我遇到了一个又一个问题。这个让我难过。

  • 在Windows 10上安装minikube
  • Docker已经在hyperv上运行了几个月了
  • 使用choco跟着windows,然后忽略了hyperv install的所有操作。

  • W0107 08:23:27.485052 3337 common.go:77] your configuration file uses a deprecated API spec: "kubeadm.k8s.io/v1beta1". Please use 'kubeadm config migrate --old-config old.yaml --new-config new.yaml', which will write the new, similar spec using a newer API version.



    据我了解,有一个新的配置。我需要迁移到。为此,我需要使用kubeadm,但我无法找到有关在哪里可以找到这些文件或如何进行迁移的任何信息。这是我尝试过的。

    在提升的命令提示符下,我运行了:
  • minikube ssh

  • 然后我在以下目录中找到了kubeadm。
  • cd /var/lib/minikube/binaries/v1.17.0

  • 在哪里我开始向它抛出一些随机命令,希望有所帮助
    $ ./kubeadm version
    kubeadm version: &version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:17:50Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}


    $ ./kubeadm config view
    failed to load admin kubeconfig: open /home/docker/.kube/config: no such file or directory
    To see the stack trace of this error execute with --v=5 or higher

    $ ./kubeadm init --config defaults
    unable to read config from "defaults" : open defaults: no such file or directory
    To see the stack trace of this error execute with --v=5 or higher

    正如错误消息所说的那样,我放弃了。那也不起作用
    $ ./kubeadm config migrate --old-config old.yaml --new-config new.yaml
    open old.yaml: no such file or directory
    To see the stack trace of this error execute with --v=5 or higher

    浏览日志后,我发现它正在尝试加载以下配置文件,因此我尝试将其作为旧文件加载,以希望它足够聪明以创建自己的新文件。
    ./kubeadm config migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-config new.yaml
    open /var/tmp/minikube/kubeadm.yaml: permission denied
    To see the stack trace of this error execute with --v=5 or higher

    好的,然后检查文件的权限
    $ ls -la /var/tmp/minikube/kubeadm.yaml
    -rw-r----- 1 root root 1156 Jan 1 0001 /var/tmp/minikube/kubeadm.yaml

    好吧,让我们尝试更新它
    $ chmod u=r /var/tmp/minikube/kubeadm.yaml
    chmod: changing permissions of '/var/tmp/minikube/kubeadm.yaml': Operation not
    permitted


    $ sudu chmod u=r /var/tmp/minikube/kubeadm.yaml
    -bash: sudu: command not found

    编辑须藤
     $ sudo chmod u=r /var/tmp/minikube/kubeadm.yaml 
    $ ls -la /var/tmp/minikube/kubeadm.yaml
    -r--r----- 1 root root 1156 Jan 1 0001 /var/tmp/minikube/kubeadm.yaml

    更新777
    $ sudo chmod 777 /var/tmp/minikube/kubeadm.yaml
    $ ls -la /var/tmp/minikube/kubeadm.yaml
    -rwxrwxrwx 1 root root 1156 Jan 1 0001 /var/tmp/minikube/kubeadm.yaml
    fig new.yamlconfig migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-conf
    W0107 13:19:23.298409 4361 validation.go:28] Cannot validate kube-proxy config - no validator is available
    W0107 13:19:23.298437 4361 validation.go:28] Cannot validate kubelet config - no validator is available
    failed to write the new configuration to the file "new.yaml": open new.yaml: permission denied
    To see the stack trace of this error execute with --v=5 or higher

    仍然没有骰子。这似乎是一个非常有限的bash shell。

    有一个文件

    好的,感谢一些chmod 777,我知道有一个文件,但是我该怎么办?
    ./kubeadm config migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-config /home/docker/new.yaml
    W0107 13:22:21.615314 6352 validation.go:28] Cannot validate kube-proxy config - no validator is available
    W0107 13:22:21.615375 6352 validation.go:28] Cannot validate kubelet config - no validator is available

    关于如何处理此问题的文件似乎很少或没有,我已经在论坛上交叉发布了此问题。 #6227任何帮助将不胜感激。我试图删除minikube并以相同的结果再次添加它。

    当前状态
    sudo chmod 777 /var/tmp/minikube/kubeadm.yaml
    ls -la /var/tmp/minikube/kubeadm.yaml
    cd /var/lib/minikube/binaries/v1.17.0
    ./kubeadm config migrate --old-config /var/tmp/minikube/kubeadm.yaml --new-config /home/docker/new.yaml
    sudo chmod 777 /var/tmp/minikube
    mv /var/tmp/minikube/kubeadm.yaml /var/tmp/minikube/kubeadmold.yaml
    mv /home/docker/new.yaml /var/tmp/minikube/kubeadm.yaml

    minikube start --vm-driver=hyperv --v=7 --alsologtostderr

    没有更改相同的错误消息。

    1.16.0
    C:\Windows\system32>minikube start --vm-driver=hyperv --kubernetes-version=1.16.0
    * minikube v1.6.0 on Microsoft Windows 10 Pro 10.0.18363 Build 18363
    * Selecting 'hyperv' driver from user configuration (alternates: [])
    * Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...
    ! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
    ! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
    ! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
    ! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
    ! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
    ! Unable to verify SSH connectivity: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address. Will retry...
    X minikube is unable to connect to the VM: dial tcp: address fe80::215:5dff:fe37:c505:22: too many colons in address

    This is likely due to one of two reasons:

    - VPN or firewall interference
    - hyperv network configuration issue

    Suggested workarounds:

    - Disable your local VPN or firewall software
    - Configure your local VPN or firewall to allow access to fe80::215:5dff:fe37:c505
    - Restart or reinstall hyperv
    - Use an alternative --vm-driver

    最佳答案

    如您所见kubeadm版本,建议您使用Kubernetes kubeadm,它与Minikube有点不同。

    Kubeadm 是一种使Kubernetes在现有机器上运行的工具。它将配置并启动所有必需的Kubernetes组件。使用Kubeadm,您可以创建具有多个节点的集群(kubeadm连接)。

    Minikube 是一个工具,用于启动单个Kubernets Cluster本地节点。

    在这个Stackoverflow问题中已经有很好的解释。

    我认为 Linux 中的Kubeadm configuration无法在 Windows 上使用。正如您在评论中提到的那样,您想在Windows中运行Minikube来学习Kubernetes,我将逐步介绍如何在Windows 10上运行Minikube

    在Windows 10上安装Minikube

    由于您已经有了docker,因此我将跳过该安装步骤。

    1.下载kubectlminikube

    official kubernetes docs提供了最新版本。

    来自github(minikube-windows-amd64.exe)的kubectl v1.17minikube

    2.添加到PATH表单文件夹中Environment Variables

    创建一个文件夹,您将在其中粘贴kubectl.exe和重命名的minikube.exe文件。
    将此文件夹添加到PATH。 (如果有人需要here is tutorial)。

    3.在Virtual Switch Manager中创建外部Hyper-V

    转到Hyper-V。从右侧菜单中选择Virtual Switch Manager。选择External并将其命名为Primary Virtual Switch。然后申请。

    4.验证minikubekubeadm版本。

    PS C:\WINDOWS\system32> kubectl version
    Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"windows/amd64"}​
    Server Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:12:17Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"linux/amd64"}​
    PS C:\WINDOWS\system32> minikube version​
    minikube version: v1.6.2​
    commit: 54f28ac5d3a815d1196cd5d57d707439ee4bb392

    5.创建Minikube Cluster

    以管理员身份运行 PowerShell
    minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"
    PS C:\WINDOWS\system32> minikube start --vm-driver hyperv --hyperv-virtual-switch "Primary Virtual Switch"
    * minikube v1.6.2 on Microsoft Windows 10 Enterprise 10.0.17134 Build 17134​
    * Selecting 'hyperv' driver from user configuration (alternates: [])​
    * Creating hyperv VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...​
    * Preparing Kubernetes v1.17.0 on Docker '19.03.5' ...​
    * Pulling images ...​
    * Launching Kubernetes ...​
    * Waiting for cluster to come online ...​
    * Done! kubectl is now configured to use "minikube"​

    现在,您可以使用 kubectl命令,并且已经具有运行 Minikube所需的默认资源。
    PS C:\WINDOWS\system32> kubectl get pods --all-namespaces​
    NAMESPACE NAME READY STATUS RESTARTS AGE​
    kube-system coredns-6955765f44-c4cbj 1/1 Running 0 31m​
    kube-system coredns-6955765f44-rqfth 1/1 Running 0 31m​
    kube-system etcd-minikube 1/1 Running 0 31m​
    kube-system kube-addon-manager-minikube 1/1 Running 0 31m​
    kube-system kube-apiserver-minikube 1/1 Running 0 31m​
    kube-system kube-controller-manager-minikube 1/1 Running 0 31m​
    kube-system kube-proxy-j6q29 1/1 Running 0 31m​
    kube-system kube-scheduler-minikube 1/1 Running 0 31m​
    kube-system storage-provisioner 1/1 Running 0 31m

    此外,您可以查看有关在Windows上运行 Minikubethis文章。

    您也可以考虑使用 Docker for Windows,它会自动执行很多操作,但是它将安装较旧版本的 kubernetes(目前为1.14)。

    关于kubernetes - 如何在Windows 10上迁移Kubeconfig,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59625396/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com