-
Notifications
You must be signed in to change notification settings - Fork 0
/
installtion.txt
98 lines (66 loc) · 2.39 KB
/
installtion.txt
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
Install Docker Engine
---------------------
# apt-get update && apt-get install -y apt-transport-https curl
# curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
# cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
# apt-get update
# apt-get install -y kubelet kubeadm kubectl
# apt-mark hold kubelet kubeadm kubectl
Install Docker packages
---------------------------
# apt-get update && apt-get install apt-transport-https ca-certificates curl software-properties-common -y
# curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
# add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
# apt-get update && apt-get install docker-ce=18.06.2~ce~3-0~ubuntu -y
# cat > /etc/docker/daemon.json <<EOF
{
"exec-opts": ["native.cgroupdriver=systemd"],
"log-driver": "json-file",
"log-opts": {
"max-size": "100m"
},
"storage-driver": "overlay2"
}
EOF
# mkdir -p /etc/systemd/system/docker.service.d
# Restart docker.
# systemctl daemon-reload
# systemctl restart docker
# mkdir -p $HOME/.kube
# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
# sudo chown $(id -u):$(id -g) $HOME/.kube/config
# kubeadm init --apiserver-advertise-address $(hostname -i) --pod-network-cidr=192.168.0.0/16
# export kubever=$(kubectl version | base64 | tr -d '\n')
# kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever"
verify:
# kubectl get nodes
# kubectl get pods --all-namespaces
# kubectl get nodes --show-lables
# kubectl get namespaces
Recreate tokens:
---------------
# kubeadm token create --print-join-command
Manual token create and add policy:
----------------------------------
#kubeadm token list
#kubeadm token create
#openssl x509 -pubkey -in /etc/kubernetes/pki/ca.crt | openssl rsa -pubin -outform der 2>/dev/null | openssl dgst -sha256 -hex | sed 's/^.* //'
# kubeadm join --token <token> <master-ip>:6443 --discovery-token-ca-cert-hash sha256:<hash>
kubectl command handling Methods:
file update
# kubectl apply -f [filename.yaml]
all namespace pods view
------------------------
# kubectl get pods --all-namespaces
# kubectl create namespace twitter
# kubectl get all -n twitter
# kubectl get all -n twitter
#kubectl version
#kubectl cluster-info
#kubectl get pods -n kube-system
#kubectl get events