translated by Flowsnow

This commit is contained in:
chenliang 2018-10-12 23:59:35 +08:00
parent 8b9acc78ce
commit 29780b0566
2 changed files with 123 additions and 162 deletions

View File

@ -1,162 +0,0 @@
translating by Flowsnow
Getting started with Minikube: Kubernetes on your laptop
======
A step-by-step guide for running Minikube.
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ)
Minikube is advertised on the [Hello Minikube][1] tutorial page as a simple way to run Kubernetes for Docker. While that documentation is very informative, it is primarily written for MacOS. You can dig deeper for instructions for Windows or a Linux distribution, but they are not very clear. And much of the documentation—like one on [installing drivers for Minikube][2]—is targeted at Debian/Ubuntu users.
### Prerequisites
1. You have [installed Docker][3].
2. Your computer is an RHEL/CentOS/Fedora-based workstation.
3. You have [installed a working KVM2 hypervisor][4].
4. You have a working **docker-machine-driver-kvm2**. The following commands will install the driver:
```
curl -Lo docker-machine-driver-kvm2 https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 \
chmod +x docker-machine-driver-kvm2 \
&& sudo cp docker-machine-driver-kvm2 /usr/local/bin/ \
&& rm docker-machine-driver-kvm2
```
### Download, install, and start Minikube
1. Create a directory for the two files you will download: [minikube][5] and [kubectl][6].
2. Open a terminal window and run the following command to install minikube.
```
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
```
Note that the minikube version (e.g., minikube-linux-amd64) may differ based on your computer's specs.
3. **chmod** to make it writable.
```
chmod +x minikube
```
4. Move the file to the **/usr/local/bin** path so you can run it as a command.
```
mv minikube /usr/local/bin
```
5. Install kubectl using the following command (similar to the minikube installation process).
```
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
```
Use the **curl** command to determine the latest version of Kubernetes.
6. **chmod** to make kubectl writable.
```
chmod +x kubectl
```
7. Move kubectl to the **/usr/local/bin** path to run it as a command.
```
mv kubectl /usr/local/bin
```
8. Run **minikube start**. To do so, you need to have a hypervisor available. I used KVM2, and you can also use Virtualbox. Make sure to run the following command as a user instead of root so the configuration will be stored for the user instead of root.
```
minikube start --vm-driver=kvm2
```
It can take quite a while, so wait for it.
9. Minikube should download and start. Use the following command to make sure it was successful.
```
cat ~/.kube/config
```
10. Execute the following command to run Minikube as the context. The context is what determines which cluster kubectl is interacting with. You can see all your available contexts in the ~/.kube/config file.
```
kubectl config use-context minikube
```
11. Run the **config** file command again to check that context Minikube is there.
```
cat ~/.kube/config
```
12. Finally, run the following command to open a browser with the Kubernetes dashboard.
```
minikube dashboard
```
This guide aims to make things easier for RHEL/Fedora/CentOS-based operating system users.
Now that Minikube is up and running, read [Running Kubernetes Locally via Minikube][7] to start using it.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/10/getting-started-minikube
作者:[Bryant Son][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:
[b]: https://github.com/lujun9972
[1]: https://kubernetes.io/docs/tutorials/hello-minikube
[2]: https://github.com/kubernetes/minikube/blob/master/docs/drivers.md
[3]: https://docs.docker.com/install
[4]: https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver
[5]: https://github.com/kubernetes/minikube/releases
[6]: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-using-curl
[7]: https://kubernetes.io/docs/setup/minikube

View File

@ -0,0 +1,123 @@
Minikube入门笔记本上的Kubernetes
======
运行Minikube的分步指南。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ)
在[Hello Minikube][1]教程页面上Minikube被宣传为基于Docker运行Kubernetes的一种简单方法。 虽然该文档非常有用但它主要是为MacOS编写的。 你可以深入挖掘在Windows或某个Linux发行版上的使用说明但它们不是很清楚。 许多文档都是针对Debian / Ubuntu用户的比如[安装Minikube的驱动程序][2]。
### 先决条件
1. 你已经[安装了Docker][3]。
2. 你的计算机是一个RHEL / CentOS / 基于Fedora的工作站。
3. 你已经[安装了正常运行的KVM2虚拟机管理程序][4]。
4. 你有一个运行的**docker-machine-driver-kvm2**。 以下命令将安装驱动程序:
```
curl -Lo docker-machine-driver-kvm2 https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 \
chmod +x docker-machine-driver-kvm2 \
&& sudo cp docker-machine-driver-kvm2 /usr/local/bin/ \
&& rm docker-machine-driver-kvm2
```
### 下载安装和启动Minikube
1. 为你要即将下载的两个文件创建一个目录,两个文件分别是:[minikube][5]和[kubectl][6]。
2. 打开终端窗口并运行以下命令来安装minikube。
```
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
```
请注意minikube版本例如minikube-linux-amd64可能因计算机的规格而有所不同。
3. **chmod**加执行权限。
```
chmod +x minikube
```
4. 将文件移动到**/usr/local/bin**路径下,以便你能将其作为命令运行。
```
mv minikube /usr/local/bin
```
5. 使用以下命令安装kubectl类似于minikube的安装过程
```
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
```
使用**curl**命令确定最新版本的Kubernetes。
6. **chmod**给kubectl加执行权限。
```
chmod +x kubectl
```
7. 将kubectl移动到**/usr/local/bin**路径下作为命令运行。
```
mv kubectl /usr/local/bin
```
8. 运行**minikube start**命令。 为此,你需要有虚拟机管理程序。 我使用过KVM2你也可以使用Virtualbox。 确保是用户而不是root身份运行以下命令以便为用户而不是root存储配置。
```
minikube start --vm-driver=kvm2
```
这可能需要一段时间,等一会。
9. Minikube应该下载并开始。 使用以下命令确保成功。
```
cat ~/.kube/config
```
10. 执行以下命令以运行Minikube作为上下文。 上下文决定了kubectl与哪个集群交互。 你可以在~/.kube/config文件中查看所有可用的上下文。
```
kubectl config use-context minikube
```
11. 再次查看**config** 文件以检查Minikube是否存在上下文。
```
cat ~/.kube/config
```
12. 最后运行以下命令打开浏览器查看Kubernetes仪表板。
```
minikube dashboard
```
本指南旨在使RHEL / Fedora / CentOS操作系统用户操作更轻松。
现在Minikube已启动并运行请阅读[通过Minikube在本地运行Kubernetes][7]这篇官网教程开始使用它。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/10/getting-started-minikube
作者:[Bryant Son][a]
选题:[lujun9972][b]
译者:[Flowsnow](https://github.com/Flowsnow)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:
[b]: https://github.com/lujun9972
[1]: https://kubernetes.io/docs/tutorials/hello-minikube
[2]: https://github.com/kubernetes/minikube/blob/master/docs/drivers.md
[3]: https://docs.docker.com/install
[4]: https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver
[5]: https://github.com/kubernetes/minikube/releases
[6]: https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-binary-using-curl
[7]: https://kubernetes.io/docs/setup/minikube