markdown 如何在Windows 10上运行Kubernetes

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 如何在Windows 10上运行Kubernetes相关的知识,希望对你有一定的参考价值。

# Kubernetes On Windows

Early in August 2016 Microsoft released the Windows 10 Anniversary Update. There were a number of changes, but the one that got me to actually take the time to install the update was "Bash on Ubuntu on Windows".
This feature would install Ubuntu Linux without the kernel. It would run linux in user-mode. Linux would run the commands while Windows does all the work/processing. 

For an upcoming project I needed to get Kubernetes running. Being as Kubernetes is not able to be run in Windows the normally accepted way to procees is to create a virtual Linux box and run it from there. I wanted to see if Kubernetes would run in Bash on Ubuntu on Windows. 

This is how I got it to work:

## Install the Windows 10 Anniversary Update
This was pretty straight forward. [Download the Windows 10 Upgrade tool][2]. I found the tool initially [here][1]. 
The upgrade will take about 45ish minutes depending on your internet connection and computer. 

## Install Bash on Ubuntu on Windows
I followed [these instructions][3] but will also outline them here.

1. Turn on Developer Mode
   1. Open Settings -> Update and Security -> For developers
   2. Select the Developer Mode radio button
2. Add the Linux Subsystem
   1. From Start, search for "Turn Windows features on or off" (type 'turn')
   2. Select Windows Subsystem for Linux (beta)
   3. Click OK
   4. Wait for the install to finish
3. Enable the Linux subsystem feature
   1. Open a PowerShell prompt as administrator and run:
    ```
    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    ```
    2. Restart if needed
4. Run Bash on Windows. This will install all the Ubuntu files
   1. Open a command prompt
   2. Run `bash`
   3. Type `y` to accept the license and install
   4. You will be asked about a username and password. You can use any username and password. They have no relationship to Windows users. 

## Install Google SDK
Now that we have Bash running installing the Google SDK is really easy. [Documented here][4].

Run the following commands from Bash:

1. Run this to install the SDK: `curl https://sdk.cloud.google.com | bash`
2. Restart your shell: `exec -l $SHELL`
3. Initialize the gcloud environment: `gcloud init`

## Install Kubernetes
Once the SDK is installed we can finally install Kubernetes.
```
gcloud components install kubectl
```
[Example Hello World Walkthrough][5]

# Done
You can now to run `kubectl`, `gcloud` from Bash! *Woot!* 

My setup is that I will run `kubectl` from Bash, and then any `gcloud` and `docker` commands from Windows PowerShell. Which will allow me to control my GCP projects without needing another virtual machine. 

[1]: https://support.microsoft.com/en-us/help/12387/windows-10-update-history
[2]: http://go.microsoft.com/fwlink/p/?LinkId=821403
[3]: https://msdn.microsoft.com/commandline/wsl/install_guide
[4]: https://cloud.google.com/sdk/downloads#linux
[5]: http://kubernetes.io/docs/hellonode/

以上是关于markdown 如何在Windows 10上运行Kubernetes的主要内容,如果未能解决你的问题,请参考以下文章

markdown 在Windows 8和10用户中启动时运行批处理文件

markdown 在High Sierra上安装Windows 10(macOS 10.13.2)

markdown 如何修复100%磁盘使用BUG - Windows 10

如何让代码在 Windows 10 上的 GPU 上运行?

如何从 Windows 任务调度程序在(ubuntu bash windows 10)上运行程序

如何在 Windows 10 上运行 Spark Streaming 应用程序?