编程知识 cdmana.com

15. Installing kubectl and minikube on Linux

1. install kubectl

kubectl Be responsible for k8s colony talk Tools for , It's like docker cli dialogue docker Clustering is the same

Address :

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

Linux Environmental Science

step :

  • download kubectl file ( Because it's about climbing over the wall , This download may not be successful )
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl

  You can check kubectl The latest version number of the document

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

such as v1.19.3, Then copy the address to Xunlei to download kubectl file , Download good kubectl File is a binary file

https://storage.googleapis.com/kubernetes-release/release/v1.19.3/bin/linux/amd64/kubectl

And then through ftp Tools , Will download okay kubectl File upload to    “/” Under the table of contents , Do the following again .

  • Grant authority
chmod +x ./kubectl
  • Move to your assigned Directory
sudo mv ./kubectl /usr/local/bin/kubectl
  • Test for successful installation
[root@localhost ~]# 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?

2. install Docker

  • Install dependency packages
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
  • Set alicloud image source
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
  • install Docker-CE
sudo yum install docker-ce
  • start-up docker
#  Boot from boot 
sudo systemctl enable docker 
#  start-up docker service   
sudo systemctl start docker
  • Restart the service docker
systemctl daemon-reload
systemctl restart docker.service

3. install Minikube

rely on virtualbox, Will be in virtualbox The virtual machine is installed in it , Virtual opportunity is installed k8s Single node cluster .

  • download
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

  If you can't download it, use Thunderbolt to download , Reuse ftp Upload to server

If it is Xunlei's own download file , Then execute the following command

mv minikube-linux-amd64 minikube
chmod +x minikube
sudo mv minikube /usr/local/bin/
  •   start-up
minikube start

The abnormal :

[root@localhost ~]# minikube start
* Centos 7.8.2003  Upper  minikube v1.14.2
* Automatically selected the docker driver
* The "docker" 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/

X Exiting due to DRV_AS_ROOT: The "docker" driver should not be used with root privileges.

If present :The "docker" driver should not be used with root privileges.
It is not allowed to use root User run minikube, Please create a new user , And then run it with that user , And make sure that the user is added to docker Group .

  • Create user
useradd taizhuyj
passwd taizhuyj
su taizhuyj
  • Add new users to docker Group
sudo usermod -aG docker $USER && newgrp docker

Error executing command

 user name   be not in  sudoers In file , It will be reported 

su root

visudo

root    ALL=(ALL:ALL) ALL
linc    ALL=(ALL:ALL) ALL   //  Add this line to save 


su taizhuyj
  • You can do it again
sudo usermod -aG docker $USER && newgrp docker
  •   start-up Minikube

 

版权声明
本文为[Taizhu-yj]所创,转载请带上原文链接,感谢

Scroll to Top