| Guide |
Kubernetes is a well-known container management system, is a large open-source project with many contributors, it as a non-picky container management framework, can be everywhere. These two days contact k8s, take you to play k8s, this tutorial can basically let you know run Change source code, and test the local Kubernetes platform cluster from the beginning. |
Kubernetes is a big open source project with a lot of contributors, and in theory it is a non-picky container management framework that can be ubiquitous. Unfortunately, it's not easy to boot kubernetes server, whether it's actually writing or contributing to the test code. Some of the documents inside are a bit messy for me, either hanging or out of date. There are very few examples of source file changes and compilation runs, and if you run Kubernets cluster locally you have to go from scratch.
Share some of the following experience, as far as possible from the beginning to explain in detail, we chat together.
Step 1: Create a virtual machine and access
Since it's the beginning, it has to be done. Start by creating a new, clean VM to run.
650) this.width=650; "src=" http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-1.jpg "width=" 595 "height=" 831 "Class=" Alignnone size-full wp-image-63500 "style=" Height:auto; "/>
At this point, the new Google Cloud platform VM instance is created, which is a clean and pollution-free new environment.
Step 2: Prepare the virtual machine for kubernetes
This step is to be installed:
Gcc,make,socat and Git;docker, others look at their own needs, there is no need to take care of.
SSH to the new VM above, install Gcc,make,socat and git:
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-2.png "width=" 640 "height=" 78 " class= "Alignnone size-full wp-image-63501" style= "Height:auto;"/>
Install ETCD:
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-3.png "width=" 640 "height=" 59 " class= "Alignnone size-full wp-image-63502" style= "Height:auto;"/>
Install Golang (should be the 1.8+ version):
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-4.png "width=" 640 "height=" 112 "Class=" Alignnone size-full wp-image-63503 "style=" Height:auto; "/>
Step 3: Get kubernetes Source code
In this step, the Git kubernetes source code is cloned and added to the Gopath. Note that the –depth 1 is used here, as long as the latest version.
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-5.png "width=" 640 "height=" 59 " class= "Alignnone size-full wp-image-63504" style= "Height:auto;"/>
Add the Kubernetes sources to the Gopath:
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-6.png "width=" "height=" "Class=" Alignnone size-full wp-image-63505 "style=" Height:auto; "/>
Step 4: Compile and run kubernetes
It is not difficult here, because it happens to have a good goods called local-up-cluster.sh.
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-7.png "width=" 640 "height=" 74 " class= "Alignnone size-full wp-image-63506" style= "Height:auto;"/>
Output display:
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-8.jpg "width=" 640 "height=" 319 "Class=" Alignnone size-full wp-image-63507 "style=" Height:auto; "/>
Step 5: Test kubernetes
The virtual machine opens a new SHELL,CD to Kubernetes source directory Gopath, which you can then test:
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-9.jpg "width=" 640 "height=" 202 "Class=" Alignnone size-full wp-image-63508 "style=" Height:auto; "/>
Step 6: Change the source code
Add a journal line to the Kubernetes-apiserver to change the entry point, and make sure that you can see it in the log:
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-10s.jpg "width=" 640 "height=" 195 "class=" Alignnone size-full wp-image-63509 "style=" Height:auto; "/>
Step 7: Test the changes to the Kubernetes source code
Stop the local cluster and restart [email protected]:/gopath/src/k8s.io/kubernetes# hack/local-up-cluster.sh
In the tail API server log line Check for changes that occurred:
650) this.width=650; "src=" Http://www.linuxprobe.com/wp-content/uploads/2017/04/k8s-11.jpg "width=" 640 "height=" 99 "Class=" Alignnone size-full wp-image-63510 "style=" Height:auto; "/>
This is the document that created the local kubernetes cluster from scratch, not cumbersome, but also contains some of the more important points: a few simple steps were taken, a kubernetes cluster was obtained, the API server was compiled and changed, and the changes were reviewed.
Article from: Public Number: DevOps Institute
Original address: http://www.linuxprobe.com/k8s-use-play.html
This article is from the "blog" blog, please be sure to keep this source http://coderhsf.blog.51cto.com/12629645/1921749
Take you to Kubernetes