The environment Description
Setting item | details |
---|---|
Structure | A master-slave (same machine) |
IP | 192.168.163.132 |
Name card | enp0s3 |
Kubernetes | 1.16.0 |
Docker | 18.09.7 |
ETCD | 3.3.13 |
FLANNEL | 0.10.0 |
Installation Steps
Step 1: Download easypack
[root@host132 tmp]# git clone https://github.com/liumiaocn/easypack.git
Cloning into ‘easypack’…
…省略
[root@host132 tmp]#
Step 2: download binary files offline
Note: Currently used directly download the role, downloads and generates a binary package file kubernetes 1.15 related to, and then manually download kubernetes binaries to be replaced, the download directory is:
https://dl.k8s.io/v1.16.0/kubernetes-server-linux-amd64.tar.gz
Step 3: Configuration adjustment
only need to modify a setting that the following two common_vars.yml
Setting item | Setting parameters | Setpoint |
---|---|---|
var_all_in_one_hostip | Master node IP address | 192.168.163.132 |
var_flannel_opt_iface | Name card | enp0s3 |
Step 4: a key installation
prerequisites
Condition 1: Installation ansible, or more recommended version 2.4.2.0
Condition 2: ssh connection of this setting is completed, simply ssh-copy-id 192.168.163.132 (using the native IP) execution is completed
Installation command:
ansible-PlayBook 10.all-in-one.yml
Installation Examples
[root@host132 ansible]# ansible-playbook 10.all-in-one.yml
PLAY [all-in-one] **********************************************************************************************************************
TASK [clean : stop etcd service] *******************************************************************************************************
...省略
TASK [dashboard : create clusterrolebinding for dashboard] *****************************************************************************
changed: [localhost]
PLAY RECAP *****************************************************************************************************************************
localhost : ok=103 changed=95 unreachable=0 failed=0
[root@host132 ansible]#
The results confirmed
Version Confirmation
[root@host132 ansible]# kubectl version
Client Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:36:53Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.0", GitCommit:"2bd9643cee5b3b3a5ecbd3af49d09018f0773c77", GitTreeState:"clean", BuildDate:"2019-09-18T14:27:17Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}
[root@host132 ansible]#
Node confirmation
[root@host132 ansible]# kubectl get node -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
192.168.163.132 Ready <none> 81s v1.16.0 192.168.163.132 <none> CentOS Linux 7 (Core) 3.10.0-957.el7.x86_64 docker://18.9.7
[root@host132 ansible]#
coredns and dashboard service confirmation
[root@host132 ansible]# kubectl get services -n kube-system
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kube-dns ClusterIP 10.254.0.2 <none> 53/UDP,53/TCP 2m15s
kubernetes-dashboard NodePort 10.254.28.13 <none> 443:33307/TCP 110s
[root@host132 ansible]#
[root@host132 ansible]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-59db588569-mx6vw 1/1 Running 0 2m24s
kubernetes-dashboard-7c54d59f66-l2pqx 1/1 Running 0 119s
[root@host132 ansible]#
dashboard of token acknowledgment
[root@host132 ansible]# dashboard_secret=`kubectl get secrets -n kube-system | grep dashboard-admin | awk '{print $1}'`
[root@host132 ansible]# kubectl describe secret -n kube-system ${dashboard_secret} | grep -E '^token' | awk '{print $2}'
eyJhbGciOiJSUzI1NiIsImtpZCI6Imt2OG1UdHFzT0t5Tnp6VjRtNlZORmt6Tk5LRzhFRG01WTlXaU16LUVZNFkifQ.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJrdWJlLXN5c3RlbSIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VjcmV0Lm5hbWUiOiJkYXNoYm9hcmQtYWRtaW4tdG9rZW4tNzdsbDgiLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGFzaGJvYXJkLWFkbWluIiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZXJ2aWNlLWFjY291bnQudWlkIjoiZDk1NmJjYzItN2ZiNS00NDdmLThlNWEtNjM3ZTQ2NmNkOTc3Iiwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50Omt1YmUtc3lzdGVtOmRhc2hib2FyZC1hZG1pbiJ9.sImW-gcsHr7NJjEbIOOO1TRB0ZlF-CFRb9AXq8O38qf9E0xSZPUXeRFf8i9AST1HDZn8ugAv77TVtzj8AJaL4hxz6LylQpjhkpBxkpRMA7A7V8nhaYPxSvZUJBSpj_h2NcXNrpj7m0_V0axk9VguE_kcuTWlr2sR7x35Xmf-lxWS0yQAUkvaX26F59IBVCXZ2_A5cHWbfBvufBcGPrhKuVfJiHTUyDLha37Ze1OCCsPJP-HDnwniJsdIac89M9w9QZ1qNrtRXAlKLN24pXg_Ki5dkmYU4ImkF4YRsHAfzqkmaYHc-UoKUzJET1UqjHyqKoK64JuNHeer4RwADBF7CQ
[root@host132 ansible]#
dashboard confirmation
Use https: // localhost: 33307 login dashboard interface, select token way, and paste the above token information
You can see the information dashboard visualization interface display Kubernetes related to after landing