Kubernetes the environment to build

Installation concept description

1.这里我们的安装是基于Centos机器,然后安装K8S以及相关的K8S的组件,当然这个也必须有docker的安装;
2.那这里就涉及到一些本地Windows环境或者Mac机器如何去拥有Centos机器的问题?
	2.1.一种是在本地安装虚拟机,然后创建centos操作系统的机器
	2.2.另外一种的话,大家可以去阿里云或者其他的云平台上买一台centos的机器,去进行相关的实操训练;
3.下面的几种搭建Kubernetes环境的方式,根据大家不同的需要(有可能只是了解,学些,或者有些是企业级的应用)
  去选择自己的方式;另外有些方式,我们只是提供指导,未进行实际的操作,大家可以参考对应的官网操作实施;
4.另外我们这里说的K8S的组件主要是下面这些:
	4.1.kube-controller
	4.2.cloud-controller
	4.3.kuber-apiserver
	4.4.etcd
	4.5.kuber-scheduler
	4.6.kubelet
	等等  

Here Insert Picture Description

The Hard Way (entry stage is not recommended)

https://github.com/kelseyhightower/kubernetes-the-hard-way
step
Here Insert Picture Description

The Easy Way [simulation study]

Use the following address to simulate learning

https://labs.play-with-k8s.com/

Here Insert Picture Description

Log In to create three machines

Here Insert Picture Description
After creation
Here Insert Picture Description
after creation, the following prompt will appear on each machine

 1. Initializes cluster master node:

 kubeadm init --apiserver-advertise-address $(hostname -i)


 2. Initialize cluster networking:

 kubectl apply -n kube-system -f \
    "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 |tr -d '\n')"


 3. (Optional) Create an nginx deployment:

 kubectl apply -f https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/nginx-app.yaml

Set Master Node node [192.168.0.11]

[node3 ~]$ kubeadm init --apiserver-advertise-address $(hostname -i)
Initializing machine ID from random generator.
I1222 03:43:06.130817    1273 version.go:240] remote version is much newer: v1.17.0; falling back to: stable-1.14
[init] Using Kubernetes version: v1.14.10
[preflight] Running pre-flight checks
        [WARNING Service-Docker]: docker service is not active, please run 'systemctl start docker.service'
        [WARNING IsDockerSystemdCheck]: detected "cgroupfs" as the Docker cgroup driver. The recommended driveris "systemd". Please follow the guide at https://kubernetes.io/docs/setup/cri/
        [WARNING FileContent--proc-sys-net-bridge-bridge-nf-call-iptables]: /proc/sys/net/bridge/bridge-nf-call-iptables does not exist
[preflight] The system verification failed. Printing the output from the verification:
KERNEL_VERSION: 4.4.0-165-generic
DOCKER_VERSION: 19.03.5
OS: Linux
CGROUPS_CPU: enabled
CGROUPS_CPUACCT: enabled
CGROUPS_CPUSET: enabled
CGROUPS_DEVICES: enabled
CGROUPS_FREEZER: enabled
CGROUPS_MEMORY: enabled
        [WARNING SystemVerification]: this Docker version is not on the list of validated versions: 19.03.5. Latest validated version: 18.09
        [WARNING SystemVerification]: failed to parse kernel config: unable to load kernel module: "configs", output: "", err: exit status 1
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Activating the kubelet service
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [node3 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.0.11]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [node3 localhost] and IPs [192.168.0.11 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [node3 localhost] and IPs [192.168.0.11 127.0.0.1 ::1]
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to 

Worker Node node set [192.168.0.12,192.168.0.13]

K8S way to build on the cloud - using kops

https://github.com/kubernetes/kops

Enterprise Solutions ---- coreos

https://coreos.com/

Use Minikube up a local stand-alone version of K8S (MAC system)

Official warehouse document
https://kubernetes.io/docs/setup/learning-environment/minikube/

Here Insert Picture Description

1. Install Virtual Machine [VirtualBox] and verify that the installation was successful

1.VirtualBox mounting reference address
https://blog.csdn.net/u014636209/article/details/103052261

2. Verify success

localhost:~ gaoxinfu$ sysctl -a | grep -E --color 'machdep.cpu.features|VMX' 
machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C
localhost:~ gaoxinfu$ 

Here Insert Picture Description

1.VMX被标红,说明已经安装成功

2. AnSo minikube

https://blog.csdn.net/u014636209/article/details/103695825

Kubeadm / binary mode, set up a local cluster K8S

Published 261 original articles · won praise 37 · Views 200,000 +

Guess you like

Origin blog.csdn.net/u014636209/article/details/103659604