Home
>
Archives
>
Kubernetes线下实战培训
Kubernetes线下实战培训
Publish:
前提条件
- 准备好3台电脑
- 准备好相关素材文件
- 关闭系统防火墙
IP地址配置信息
- Master(172.17.116.249)
- Worker1(172.17.116.250)
- Worker2(172.17.116.251)
关闭防火墙
1
2
3
4
5
| systemctl stop firewalld.service
systemctl disable firewalld.service
yum install iptables-services
service iptables start
service iptables stop
|
挂载硬盘
1
2
3
| echo /dev/vdb1 /mnt ext3 defaults 0 0 >> /etc/fstab
mount /dev/vdb1 /mnt
df -hl
|
安装步骤
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
| yum install jq
./install-docker.sh docker-18.06.1-ce.tgz
docker run -it hello-world
docker ps
./install-etcd.sh etcd-v3.3.9-linux-amd64.tar.gz 01 172.17.116.249 172.17.116.249 172.17.116.250 172.17.116.251
./install-etcd.sh etcd-v3.3.9-linux-amd64.tar.gz 02 172.17.116.250 172.17.116.249 172.17.116.250 172.17.116.251
./install-etcd.sh etcd-v3.3.9-linux-amd64.tar.gz 03 172.17.116.251 172.17.116.249 172.17.116.250 172.17.116.251
./start-etcd.sh
systemctl start etcd
source /etc/profile
etcdctl cluster-health
docker load -i k8s-images.tar.gz
./install-k8s.sh kubernetes-server-linux-amd64.tar.gz 172.17.116.249 172.17.116.249
./install-k8s.sh kubernetes-server-linux-amd64.tar.gz 172.17.116.250 172.17.116.249
./install-k8s.sh kubernetes-server-linux-amd64.tar.gz 172.17.116.251 172.17.116.249
kubectl get nodes
cat /root/.kube/config
ifconfig
./install-flannel.sh flannel-v0.7.1-linux-amd64.tar.gz 172.17.116.249 172.17.116.249 eth0
./install-flannel.sh flannel-v0.7.1-linux-amd64.tar.gz 172.17.116.250 172.17.116.249 eth0
./install-flannel.sh flannel-v0.7.1-linux-amd64.tar.gz 172.17.116.251 172.17.116.249 eth0
ifconfig
etcdctl ls
etcdctl ls /atomic.io/network
etcdctl ls /atomic.io/network/subnets
etcdctl get /atomic.io/network/subnets/192.168.3.0-24
yum -y install nfs-utils
./setUpNFS.sh
cat /etc/exports
./setUpNFS.sh /var/vols/test
kubectl get svc
watch kubectl get pods --all-namespaces -o wide
kubectl create ns core
kubectl get ns
kubectl create -f kube-dns.yaml
kubectl get pod -n core
kubectl get svc -n core
kubectl create -f pv-pvc.yaml
kubectl get pv -o json | jq -r '.items[].spec.nfs.server'
kubectl get pvc -n core
kubectl get svc -n core
kubectl create -f kube-registry-proxy.yaml
kubectl get ep -n core
kubectl label node 172.17.116.249 nodetype=master
kubectl create -f registry-with-volume.yaml
kubectl get node
kubectl get node 172.17.116.249 -o json | jq
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -F
iptables -L -n
kubectl exec -it kube-registry-proxy-lnthx -n core sh
ping kube-dns.cluster.local
kubectl describe pod kube-registry-ccc98dc-tljxz -n core
docker images
docker push localhost:5000/centos
---day3
curl -v http://localhost:5000/v2/_catalog
curl http://localhost:5000/v2/_catalog
kubectl log
http://16.187.191.76:8080/api/v1/namespaces/core/services/https:kubernetes-dashboard:/proxy
http://16.187.191.76:8080/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
http://127.0.0.1:8080/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/
从aliyun配置链接串, ./kube/config
kubectl get pods --all-namespaces
hostname -i
kubectl create ns core
kubectl create -f pv-pvc.yaml
kubectl create -f kube-registry.yaml
watch kubectl get pods -n core -o wide
kubectl create -f kube-registry-proxy.yaml
kubectl crate secret docker -registry regsecret
-- docker-server=registry.cn-shanghai.aliyuncs.com -- docker-username=username
systemctl daemon-reload
systemctl restart kubelet
|
声明: 本文采用 BY-NC-SA 授权。转载请注明转自: Ding Bao Guo