mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-23 21:20:42 +08:00
commit
ea27b114c0
@ -1,201 +0,0 @@
|
||||
[#]: subject: "How to Install MiniKube on RHEL 8/Rocky Linux 8/AlmaLinux 8"
|
||||
[#]: via: "https://www.linuxtechi.com/install-minikube-on-rhel-rockylinux-almalinux/"
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
How to Install MiniKube on RHEL 8/Rocky Linux 8/AlmaLinux 8
|
||||
======
|
||||
|
||||
In this post, we will cover how to install minikube on RHEL 8, Rocky Linux 8 or AlmaLinux 8 step by step.
|
||||
|
||||
Minikubeis a cross-platform and open-source tool that makes it possible for you to deploy a single-node Kubernetes cluster on your local machine.
|
||||
|
||||
Kubernetes, also known as k8sor simply as Kube, is an open-source container orchestration platform used for the automation scaling and deployment of containers.Minikube cluster helps developers and admins to build their test environment in minikube cluster.
|
||||
|
||||
##### Prerequisites of MiniKube
|
||||
|
||||
- Minimal Installed RHEL 8 or Rocky Linux 8 or AlmaLinux 8
|
||||
- Locally Configured Repo or Subscription for RHEL 8.
|
||||
- Minimum of 2 GB RAM and 2 vCPUs
|
||||
- 20 GB hard disk space
|
||||
- Sudo User with admin
|
||||
- A stable internet connection
|
||||
- Docker or virtual machine manager like VirtualBox, KVM,and VMware etc.
|
||||
|
||||
In this post, we will be using docker as driver for minikube. With all the prerequisites met, it’s time now to roll up our sleeves and get our hands dirty.
|
||||
|
||||
### Step 1) Enable Official Docker Repository
|
||||
|
||||
To enable docker official repository run,
|
||||
|
||||
```
|
||||
$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
|
||||
$ sudo dnf repolist
|
||||
```
|
||||
|
||||
### Step 2) Install Docker CE (Community Edition)
|
||||
|
||||
Run the following dnf command to install docker and its dependencies,
|
||||
|
||||
```
|
||||
$ sudo dnf install docker-ce docker-ce-cli containerd.io -y
|
||||
```
|
||||
|
||||
output,
|
||||
|
||||
Once docker is installed the start and enable it’s service, run following systemctl commands,
|
||||
|
||||
```
|
||||
$ sudo systemctl start docker
|
||||
$ sudo systemctl start docker
|
||||
```
|
||||
|
||||
Allow your local user to run docker commands without sudo, run
|
||||
|
||||
```
|
||||
$ sudo usermod -aG docker $USER
|
||||
$ newgrp docker
|
||||
```
|
||||
|
||||
### Step 3) Install Kubectl Binary
|
||||
|
||||
Kubectl is a command-line tool which interacts with Kubernetes cluster via APIs. Using kubectl we deploy our applications as deployment. By default, kubectl is not included in RHEL 8 , Rocky Linux 8 or AlmaLinux 8 package repositories. Therefore, we are going to manually install it using beneath commands,
|
||||
|
||||
```
|
||||
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
$ sudo cp kubectl /usr/local/bin/ && sudo chmod +x /usr/local/bin/kubectl
|
||||
$ kubectl version --client
|
||||
```
|
||||
|
||||
Output of above commands would be something like below,
|
||||
|
||||
### Step 4) Download MiniKube Binary and Start Cluster
|
||||
|
||||
After installing the kubectl, let’s download and install minikube binary using the following commands,
|
||||
|
||||
```
|
||||
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
|
||||
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube
|
||||
```
|
||||
|
||||
Now start minikube cluster using the beneath command,
|
||||
|
||||
```
|
||||
$ minikube start --driver docker
|
||||
```
|
||||
|
||||
Output above confirms that minikube command has started the single node Kubernetes cluster using docker as driver.
|
||||
|
||||
Run below minikube command to verify the status of your local Kubernetes cluster,
|
||||
|
||||
```
|
||||
[[email protected] ~]$ minikube status
|
||||
minikube
|
||||
type: Control Plane
|
||||
host: Running
|
||||
kubelet: Running
|
||||
apiserver: Running
|
||||
kubeconfig: Configured
|
||||
[[email protected] ~]$
|
||||
[[email protected] ~]$ minikube ip
|
||||
192.168.49.2
|
||||
[[email protected] ~]$
|
||||
```
|
||||
|
||||
To stop stop the minikube cluster, execute,
|
||||
|
||||
```
|
||||
$ minikube stop
|
||||
```
|
||||
|
||||
Execute the “kubectl” commands to view cluster and node information
|
||||
|
||||
```
|
||||
$ kubectl cluster-info
|
||||
$ kubectl get nodes
|
||||
```
|
||||
|
||||
### Step 5) Test and Verify Kubernetes Cluster
|
||||
|
||||
To test Kubernetes cluster, let try to create k8s deployment using echo server image, it is equivalent to http web server and expose it as a service on port 8080,
|
||||
|
||||
```
|
||||
[[email protected] ~]$ kubectl create deployment test-minikube --image=k8s.gcr.io/echoserver:1.10
|
||||
deployment.apps/test-minikube created
|
||||
[[email protected] ~]$
|
||||
```
|
||||
|
||||
To access test-minikube deployment, expose it as service, run the following command,
|
||||
|
||||
```
|
||||
[[email protected] ~]$ kubectl expose deployment test-minikube --type=NodePort --port=8080
|
||||
service/test-minikube exposed
|
||||
[[email protected] ~]$
|
||||
```
|
||||
|
||||
Run below kubectl command to get deployment,pods and service information for above created deployment,
|
||||
|
||||
```
|
||||
$ kubectl get deployment,pods,svc
|
||||
```
|
||||
|
||||
To access service, get its url by running the beneath command.
|
||||
|
||||
```
|
||||
[[email protected] ~]$ minikube service test-minikube --url
|
||||
http://192.168.49.2:32291
|
||||
[[email protected] ~]$
|
||||
[[email protected] ~]$ curl http://192.168.49.2:32291/
|
||||
```
|
||||
|
||||
Great, it means our Kubernetes cluster is working fine as we are able to access our sample application.
|
||||
|
||||
##### Step 6) Enable MiniKube Addons
|
||||
|
||||
Minikube offers addons which can add additional functionality to our clusters. To list all available addons run,
|
||||
|
||||
```
|
||||
$ minikube addons list
|
||||
```
|
||||
|
||||
Kubernetes ships with a dashboard that allows you to manage your cluster. In Minikube, dashboard has been added as an addons. So to enable it, run
|
||||
|
||||
```
|
||||
$ minikube addons enable dashboard
|
||||
```
|
||||
|
||||
Also to enable nginx ingress controller, run
|
||||
|
||||
```
|
||||
$ minikube addons enable ingress
|
||||
```
|
||||
|
||||
To access the dashboard, run
|
||||
|
||||
```
|
||||
$ minikube dashbaord --url
|
||||
```
|
||||
|
||||
This will start the dashboard in your systems’s web vrowser.
|
||||
|
||||
And that’s just about it. We have managed to successfully install Kubernetes with Minikube on RHEL 8, Rocky Linux 8 or AlmaLinux 8. You are welcome to share your feedback and comments in below comments section.
|
||||
|
||||
**Also Read**: How to Configure NFS based Persistent Volume in Kubernetes
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/install-minikube-on-rhel-rockylinux-almalinux/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linuxtechi.com/author/pradeep/
|
||||
[b]: https://github.com/lkxed/
|
@ -0,0 +1,229 @@
|
||||
[#]: subject: "How to Install MiniKube on RHEL 8/Rocky Linux 8/AlmaLinux 8"
|
||||
[#]: via: "https://www.linuxtechi.com/install-minikube-on-rhel-rockylinux-almalinux/"
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
如何在 RHEL 8/Rocky Linux 8/AlmaLinux 8 上安装 MiniKube
|
||||
======
|
||||
|
||||
在这篇文章中,我们将逐步介绍如何在 RHEL 8、Rocky Linux 8 或 AlmaLinux 8 上安装 minikube。
|
||||
|
||||
Minikube 是一个跨平台的开源工具,可以让你在本地机器上部署单节点 Kubernetes 集群。
|
||||
|
||||
Kubernetes,也被称为 k8sor 简称 Kube,是一个开源的容器编排平台,用于容器的自动化扩展和部署。Minikube 集群帮助开发人员和管理员在 minikube 集群中构建他们的测试环境。
|
||||
|
||||
##### MiniKube 的先决条件
|
||||
|
||||
- 最小安装的 RHEL 8 或 Rocky Linux 8 或 AlmaLinux 8
|
||||
- 本地配置的 RHEL 8 仓库或订阅
|
||||
- 至少 2GB RAM 和 2 个 vCPU
|
||||
- 20GB 硬盘空间
|
||||
- 具有管理员身份的 Sudo 用户
|
||||
- 稳定的互联网连接
|
||||
- Docker 或虚拟机管理器,如 VirtualBox、KVM 和 VMware 等
|
||||
|
||||
在这篇文章中,我们将使用 docker 作为 minikube 的驱动程序。满足所有先决条件后,现在是时候卷起袖子动手了。
|
||||
|
||||
### 步骤 1)启用官方 Docker 仓库
|
||||
|
||||
要启用 docker 官方仓库,运行:
|
||||
|
||||
```
|
||||
$ sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
|
||||
$ sudo dnf repolist
|
||||
```
|
||||
|
||||
![][1]
|
||||
|
||||
### 步骤 2)安装 Docker CE(社区版)
|
||||
|
||||
运行以下 dnf 命令来安装 docker 及其依赖项:
|
||||
|
||||
```
|
||||
$ sudo dnf install docker-ce docker-ce-cli containerd.io -y
|
||||
```
|
||||
|
||||
output:
|
||||
|
||||
![][2]
|
||||
|
||||
安装 docker 后启动并启用它的服务,运行以下 systemctl 命令:
|
||||
|
||||
```
|
||||
$ sudo systemctl start docker
|
||||
$ sudo systemctl start docker
|
||||
```
|
||||
|
||||
允许你的本地用户在没有 sudo 的情况下运行 docker 命令,运行:
|
||||
|
||||
```
|
||||
$ sudo usermod -aG docker $USER
|
||||
$ newgrp docker
|
||||
```
|
||||
|
||||
### 步骤 3)安装 Kubectl 二进制文件
|
||||
|
||||
Kubectl 是一个命令行工具,它通过 API 与 Kubernetes 集群进行交互。使用 kubectl 我们将应用部署为 deployment。默认情况下,kubectl 不包含在 RHEL 8 、Rocky Linux 8 或 AlmaLinux 8 软件包仓库中。因此,我们将使用下面的命令手动安装它:
|
||||
|
||||
```
|
||||
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
|
||||
$ sudo cp kubectl /usr/local/bin/ && sudo chmod +x /usr/local/bin/kubectl
|
||||
$ kubectl version --client
|
||||
```
|
||||
|
||||
以上命令的输出如下所示:
|
||||
|
||||
![][3]
|
||||
|
||||
### 步骤 4)下载 MiniKube 二进制文件并启动集群
|
||||
|
||||
安装 kubectl 后,让我们使用以下命令下载并安装 minikube 二进制文件:
|
||||
|
||||
```
|
||||
$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
|
||||
$ sudo install minikube-linux-amd64 /usr/local/bin/minikube
|
||||
```
|
||||
|
||||
现在使用下面的命令启动 minikube 集群:
|
||||
|
||||
```
|
||||
$ minikube start --driver docker
|
||||
```
|
||||
|
||||
![][4]
|
||||
|
||||
上面的输出确认 minikube 命令已经使用 docker 作为驱动程序启动了单节点 Kubernetes 集群。
|
||||
|
||||
运行下面的 minikube 命令来验证本地 Kubernetes 集群的状态:
|
||||
|
||||
```
|
||||
[[email protected] ~]$ minikube status
|
||||
minikube
|
||||
type: Control Plane
|
||||
host: Running
|
||||
kubelet: Running
|
||||
apiserver: Running
|
||||
kubeconfig: Configured
|
||||
[[email protected] ~]$
|
||||
[[email protected] ~]$ minikube ip
|
||||
192.168.49.2
|
||||
[[email protected] ~]$
|
||||
```
|
||||
|
||||
要停止 minikube 集群,请执行:
|
||||
|
||||
```
|
||||
$ minikube stop
|
||||
```
|
||||
|
||||
执行 “kubectl” 命令查看集群和节点信息:
|
||||
|
||||
```
|
||||
$ kubectl cluster-info
|
||||
$ kubectl get nodes
|
||||
```
|
||||
|
||||
![][5]
|
||||
|
||||
### 步骤 5)测试和验证 Kubernetes 集群
|
||||
|
||||
为了测试 Kubernetes 集群,让我们尝试使用 echo 服务器镜像创建 k8s 部署,它相当于 http web 服务器并将其作为服务暴露在端口 8080 上:
|
||||
|
||||
```
|
||||
[[email protected] ~]$ kubectl create deployment test-minikube --image=k8s.gcr.io/echoserver:1.10
|
||||
deployment.apps/test-minikube created
|
||||
[[email protected] ~]$
|
||||
```
|
||||
|
||||
要访问 test-minikube 部署,将其公开为服务,运行以下命令:
|
||||
|
||||
```
|
||||
[[email protected] ~]$ kubectl expose deployment test-minikube --type=NodePort --port=8080
|
||||
service/test-minikube exposed
|
||||
[[email protected] ~]$
|
||||
```
|
||||
|
||||
运行以下 kubectl 命令以获取上面创建的部署的 deployment、pods 和服务信息:
|
||||
|
||||
```
|
||||
$ kubectl get deployment,pods,svc
|
||||
```
|
||||
|
||||
![][6]
|
||||
|
||||
要访问服务,请通过运行下面的命令获取其 url:
|
||||
|
||||
```
|
||||
[[email protected] ~]$ minikube service test-minikube --url
|
||||
http://192.168.49.2:32291
|
||||
[[email protected] ~]$
|
||||
[[email protected] ~]$ curl http://192.168.49.2:32291/
|
||||
```
|
||||
|
||||
![][7]
|
||||
|
||||
太好了,这意味着我们的 Kubernetes 集群工作正常,因为我们能够访问我们的示例应用。
|
||||
|
||||
##### 步骤 6)启用 MiniKube 插件
|
||||
|
||||
Minikube 提供插件,可以为我们的集群添加额外的功能。要列出所有可用的插件,运行:
|
||||
|
||||
```
|
||||
$ minikube addons list
|
||||
```
|
||||
|
||||
![][8]
|
||||
|
||||
Kubernetes 附带一个仪表板,可让你管理集群。在 Minikube 中,仪表板已作为插件添加。所以要启用它,运行:
|
||||
|
||||
```
|
||||
$ minikube addons enable dashboard
|
||||
```
|
||||
|
||||
还要启用 nginx 入口控制器,运行:
|
||||
|
||||
```
|
||||
$ minikube addons enable ingress
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
要访问仪表板,运行:
|
||||
|
||||
```
|
||||
$ minikube dashbaord --url
|
||||
```
|
||||
|
||||
这将在你系统的浏览器中启动仪表板。
|
||||
|
||||
![][10]
|
||||
|
||||
就是这些了。我们已经成功地在 RHEL 8、Rocky Linux 8 或 AlmaLinux 8 上使用 Minikube 安装 Kubernetes。欢迎你在下面的评论部分分享你的反馈和意见。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/install-minikube-on-rhel-rockylinux-almalinux/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.linuxtechi.com/author/pradeep/
|
||||
[b]: https://github.com/lkxed/
|
||||
[1]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Enable-Docker-Repo-RHEL8-Rocky-Linux8-1024x203.png?ezimgfmt=ng:webp/ngcb22
|
||||
[2]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Install-Docker-DNF-Command-RHEL8-RockyLinux8.png
|
||||
[3]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Download-Kubectl-Binary-RHEL8-RockyLinux8.png
|
||||
[4]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Start-Minikube-Cluster-RHEL8-Rocky-Linux8.png
|
||||
[5]: https://www.linuxtechi.com/wp-content/uploads/2020/04/K8s-cluster-info-RHEL8-RockyLinux9-1024x193.png?ezimgfmt=ng:webp/ngcb22
|
||||
[6]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Kubectl-get-pods-deplyments-service-rhel8-rocky-linux8.png?ezimgfmt=ng:webp/ngcb22
|
||||
[7]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Access-Application-minikube-rhel8-rockylinux8.png?ezimgfmt=ng:webp/ngcb22
|
||||
[8]: https://www.linuxtechi.com/wp-content/uploads/2020/04/minikube-addons-list-rhel8-rockylinux8.png?ezimgfmt=ng:webp/ngcb22
|
||||
[9]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Enable-Minikube-addons-RHEL8-RockyLinux9-1024x381.png?ezimgfmt=ng:webp/ngcb22
|
||||
[10]: https://www.linuxtechi.com/wp-content/uploads/2020/04/Kubernetes-Dashboard-MiniKube-Dashboard.png?ezimgfmt=ng:webp/ngcb22
|
Loading…
Reference in New Issue
Block a user