Create a k8s standalone environment using minikube

Source: Internet
Author: User
Tags etcd k8s

Tip

This blog post mainly records how to use the centos system to install minikube in a local environment. It fills in a lot of problems that may result in failed image download during the installation process, mainly using kubernete 1.12.1, for other different versions, the method is the same.

1. Download the deployment installation package
 
Wget https://storage.googleapis.com/minikube/releases/v0.30.0/minikube-linux-amd64mv minikube-linux-amd64/usr/bin/minikubewget https://dl.k8s.io/v1.12.1/kubernetes-server-linux-amd64.tar.gztar XF kubernetes-server-linux-amd64.tar.gz & CD kubernetes/Server/bin/CP kubectl kubeadm kubelet/usr/local/bin/
2. Install docker

UploadDocker-ce-17.03.2.ce-1.el7.centos.x86_64.rpmAndDocker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpmTo the server, run the following command to install docker:

Yum install docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm-yyum install docker-ce-17.03.2.ce-1.el7.centos.x86_64.rpm-y

Start the docker service and set docker to start automatically:

 
Systemctl start dockersystemctl enable docker
3. Download the docker image of kubernetes

Create the following script:

 
VI auto_pull_images.sh

Add the following content to the script:

#! /Bin/bashimages = (kube-proxy-amd64: v1.12.1 kube-scheduler-amd64: v1.12.1 kube-controller-manager-amd64: v1.12.1 kube-apiserver-amd64: v1.12.1 etcd-amd64: 3.2.24 pause-amd64: 3.1 kubernetes-dashboard-amd64: v1.10.0 k8s-dns-sidecar-amd64: 1.14.8 k8s-dns-kube-dns-amd64: 1.14.8k8s-dns-dnsmasq-nanny-amd64: 1.14.8) for imagename in $ {images [@]}; do docker pull mirrorcontainers/$ imagename docker tag mirrorgoogleiners/$ imagename k8s. GCR. IO/$ imagename docker RMI mirrorgoogleiners/$ imagenamedonefor N in $ (docker images | awk '{print $1 ":" $2}' | grep-V repository ); do docker tag $ n'echo $ n | SED's/-amd64 // g'' & docker RMI $ N; donedocker tag k8s. GCR. IO/kubernetes-dashboard: v1.10.0 k8s. GCR. IO/kubernetes-dashboard-amd64: v1.10.0docker pull coredns/coredns: 1.2.2 docker tag coredns/coredns: 1.2.2 k8s. GCR. IO/coredns: 1.2.2docker RMI coredns/coredns: 1.2.2docker pull container tag registry.cn-hangzhou.aliyuncs.com/anoy/kube-addon-manager:v8.6 k8s. GCR. IO/Kube-addon-Manager: v8.6docker RMI unzip pull repository tag registry.cn-hangzhou.aliyuncs.com/anoy/storage-provisioner:v1.8.1 GCR. IO/k8s-minikube/storage-provisioner: v1.8.1docker RMI registry.cn-hangzhou.aliyuncs.com/anoy/storage-provisioner:v1.8.1

Run the script:

 
Sh auto_pull_images.sh

After the script runs successfully, run the following command to confirm that the image is downloaded to the local device:

[[Email protected] ~] # Docker imagesrepository tag image ID created sizek8s. GCR. IO/Kube-proxy v1.12.1 61afff57f010 2 weeks ago 96.6 mbk8s. GCR. IO/Kube-apiserver v1.12.1 dcb029b5e3ad 2 weeks ago 194 mbk8s. GCR. IO/Kube-scheduler v1.12.1 d773ad20fd80 2 weeks ago 58.3 mbk8s. GCR. IO/Kube-controller-manager v1.12.1 aa2dd57c7329 2 weeks ago 164 mbk8s. GCR. IO/etcd 3.2.24 3cab8e1b9802 5 weeks ago 220 mbk8s. GCR. i/O/coredns 1.2.2 running fig 8 weeks ago 39.2 mbk8s. GCR. IO/kubernetes-dashboard-amd64 v1.10.0 0dab2435c100 2 months ago 122 mbk8s. GCR. IO/Kube-addon-manager v8.6 9c16409588eb 8 months ago 78.4 mbk8s. GCR. IO/kubernetes-Dashboard v1.8.3 0c60bcf89900 8 months ago 102 mbk8s. GCR. IO/k8s-dns-dnsmasq-nanny 1.14.8 c2ce1ffb51ed 9 months ago 40.9 mbk8s. GCR. IO/k8s-dns-sidecar 1.14.8 6f7f2dc7fab5 9 months ago 42.2 mbk8s. GCR. IO/k8s-dns-kube-dns 1.14.8 80cc5ea4b547 9 months ago 50.5 mbk8s. GCR. IO/pause 3.1 da86e6ba6ca1 10 months ago 742 kbgcr. IO/k8s-minikube/storage-provisioner v1.8.1 4689081edb10 11 months ago 80.8 MB
4. Start the service

Start minikube Cluster

 
Minikube start -- VM-driver = none -- registry-mirror = https://registry.docker-cn.com -- kubernetes-version v1.12.1

Start dashboard:

 
Minikube dashboard

Add an external access proxy for the dashboard. The IP address here is the local system IP Address:

 
Kubectl proxy -- Port = 8001 -- Address = '10. 0.0.2 '-- accept-hosts =' ^ .*'&

Access the dashboard through URL: http: // 10.0.0.2: 8001/API/V1/namespaces/Kube-system/services/HTTP: kubernetes-dashboard:/Proxy.

Create a k8s standalone environment using minikube

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.