前言

根据Kubenetes学习路径的七大阶段,炼气期、筑基期、金丹期、元婴期、化神期、炼虚期、大乘期;开始炼气期的第一个小阶段,安装Kubenetes环境。

目录

1、安装kubectl

2、安装minikube

3、启动本地kubenetes环境

一、安装kubectl

1、查看kubectl的版本

https://storage.googleapis.com/kubernetes-release/release/stable.txt

2、设置yum源

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

3、安装kubectl

yum -y install kubectl

二、安装minikube

1、什么是minikube
用于本地部署kubenetes集群,支持macOS,Linux,和 Windows。

2、下载安装

官网:

curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-latest.aarch64.rpm
sudo rpm -ivh minikube-latest.aarch64.rpm

国内:

curl -Lo minikube https://kubernetes.oss-cn-hangzhou.aliyuncs.com/minikube/releases/v1.17.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

3、查看版本

[root@VM-0-16-centos ~]# minikube version
minikube version: v1.17.1
commit: a15a762c3c9e158e922a8746fead5605d70ad70d

三、启动本地环境

1、启动

minikube start  #这里需要非root用户启动

2、验证

[docker@VM-0-16-centos ~]$ kubectl get po -A
NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE
kube-system   coredns-54d67798b7-2l74t           1/1     Running   0          25h
kube-system   etcd-minikube                      1/1     Running   0          25h
kube-system   kube-apiserver-minikube            1/1     Running   0          25h
kube-system   kube-controller-manager-minikube   1/1     Running   0          25h
kube-system   kube-proxy-kjcmd                   1/1     Running   0          25h
kube-system   kube-scheduler-minikube            1/1     Running   0          25h
kube-system   storage-provisioner                1/1     Running   0          25h

四、写在最后

欢迎大家关注我的公众号,一起交流、学习。

K8s炼气期(一)| minikube安装本地Kubenetes环境-LMLPHP

02-22 07:39