美文网首页
2020-08-31 阿里云ECS Centos8 安装Kube

2020-08-31 阿里云ECS Centos8 安装Kube

作者: Dickson_Wang | 来源:发表于2020-08-31 15:45 被阅读0次

参考:
https://kubernetes.io/zh/docs/tasks/tools/install-kubectl/

将yum repo修改为如下国内repo地址:

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

然后安装kubectl

yum install -y kubectl

以下代表kubectl已成功安装,但Minikube还未安装,找不到kubernetes集群

[root@iZ8vb7vhxusz03ybhov599Z ~]# kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
The connection to the server localhost:8080 was refused - did you specify the right host or port?

详细解释见:
https://kubernetes.io/zh/docs/tasks/tools/install-kubectl/#install-kubectl-on-linux

接着参考以下官方guide去安装minikube
https://kubernetes.io/zh/docs/tasks/tools/install-minikube/

[root@iZ8vbdvst1et8i3j5c41liZ kubernetes]# minikube start --vm-driver=virtualbox --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers
😄  minikube v1.12.3 on Centos 8.2.2004
✨  Using the virtualbox driver based on user configuration
🛑  The "virtualbox" driver should not be used with root privileges.
💡  If you are running minikube within a VM, consider using --driver=none:
📘    https://minikube.sigs.k8s.io/docs/reference/drivers/none/

以None启动 提示没有docker

[root@iZ8vbdvst1et8i3j5c41liZ kubernetes]# minikube start --vm-driver=none
😄  minikube v1.12.3 on Centos 8.2.2004
✨  Using the none driver based on user configuration
❗  'none' driver reported an issue: exec: "docker": executable file not found in $PATH
💡  Suggestion: Install docker
📘  Documentation: https://minikube.sigs.k8s.io/docs/reference/drivers/none/
💣  none does not appear to be installed

然后参考这个小姐姐去安装Docker即可

如果提示conntrack被kubernetes依赖,安装下即可

yum install epel-release
yum install conntrack-tools

最后启动minikube

minikube start --vm-driver=none --image-repository=registry.cn-hangzhou.aliyuncs.com/google_containers

查看下状态,至此安装完成

[root@iZ8vbdvst1et8i3j5c41liZ kubernetes]# minikube status
minikube
type: Control Plane
host: Running
kubelet: Running
apiserver: Running
kubeconfig: Configured

[root@iZ8vbdvst1et8i3j5c41liZ kubernetes]# kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.0", GitCommit:"e19964183377d0ec2052d1f1fa930c4d7575bd50", GitTreeState:"clean", BuildDate:"2020-08-26T14:30:33Z", GoVersion:"go1.15", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.3", GitCommit:"2e7996e3e2712684bc73f0dec0200d64eec7fe40", GitTreeState:"clean", BuildDate:"2020-05-20T12:43:34Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

[root@iZ8vbdvst1et8i3j5c41liZ kubernetes]# kubectl cluster-info
Kubernetes master is running at https://172.26.211.201:8443
KubeDNS is running at https://172.26.211.201:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

相关文章

网友评论

      本文标题:2020-08-31 阿里云ECS Centos8 安装Kube

      本文链接:https://www.haomeiwen.com/subject/jeousktx.html