one click install kubernets with shell script in Centos7. What you can learned in this project:
- how to write the linux shell .
- use expect to run command in a interacting mode, like config the login without password around some machine.
- the make file skill.
- how to install k8s, its dependencies.
- the core concepts.
- example of the k8s's core concept like: pod. deployment, dynamic pv ...
- how customization components worked fine with k8s. like: coredns, harbor. contained, dashboard and so on.
- ...
At the root path. run command:
./main.sh --ssh username password --k8s_nodes master_ip:node1_ip:node_2_ip
# example:
# your machine username and password is root/root and the k8s cluster is
# 10.128.170.31(master) 10.128.170.32 10.128.170.33
./main.sh --ssh root root --k8s_nodes 10.128.170.31:10.128.170.32:10.128.170.33
you can run ./main.sh -h for more information.
makefile supported k8s' examples. all examples will autotest after deployment.
- get all resource info.
make <get| getAll>
- create a pod:
this will create a nginx pod and open the 80 port for visiting. in this case, would delete the existed pod at first.
make <createPod | applyPod>
- delete a pod:
delete the existed pod.
make deletePod
- create a service.
create a service with type of ClusterIp, NodePort, externalName. in this case, would create a corresponding nginx pod for requests processing.
make <createService | createSvc | applyService | applySvc>
- delete a service
delete the service, and its existed pod.
make <deleteService | deleteSvc>
- create a deployment
create the deployment which has two nginx pod.
make <createDeploy | createDeployment | applyDeploy | applyDeployment>
- delete a deployment
delete the created deployment.
make <deleteDeploy | deleteDeployment>
- create a statefulSet
make <applySts | createSts | applyStatefulSet | createStatefulSet>
- delete a statefulSet
make <deleteSts | deleteStatefulSet>
- create a daemonSet
make <applyDs | applyDaemonSet | createDs | createDaemonSet>
- delete a daemonSet
make <deleteDs | deleteDaemonSet>
- create a job
make <applyJob | createJob>
- delete a job
make <deleteJob>
- create a cronJob
make <applyCj | applyCronJob | createCj | createCronjob>
- delete a cronJob
make <deleteCj | deleteCronJob>
for the example creating a service and its' pod:
- one click install k8s cluster.
- add the func to test whether the k8s installed fail or success.
- set the kube-proxy mode to ipvs from iptables.
- add the makefile for pod, service, deployment, statefulSet, daemonSet ans other examples.
- fmt the code beautifully.
- set harbor as a individual hub.
- the pv, pvc makefile.
- add the visualization user interface.
there is some thought for this project.
the process steps( installing at the master but not salves.):
- process the input. which is the common func.
- common utils installing.
- master installing.
- nodes installing in a loop from master with ssh.
- extract the trans to a lib func.
- and then, use the make cmd to install or set some customization.
- all nodes' password must in same.
- the centos's kernel must be latest:3.16.12
- only support for single node master.