-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmy-little-book-of-rancher
177 lines (117 loc) · 5.04 KB
/
my-little-book-of-rancher
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
$ My little Book of Install Rancher Kuberenetes On Ubuntu $$$
Pre setup on all servers
*.Update etc/hosts and dns must be configured.
Example
##### Kube 1.4
172.24.78.21 sdr-cont-lab01 sdr-cont-lab01
172.24.78.22 sdr-cont-lab02 sdr-cont-lab02
172.24.78.23 sdr-cont-lab03 sdr-cont-lab03
172.24.78.24 sdr-cont-lab04 sdr-cont-lab04
*. Disable swap and Selinux
As root disable swap
swapoff -a
adduser kube
passwd k
sudo echo "kube ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/kube
sudo chmod 0440 /etc/sudoers.d/kube
add Hostfile
13.56.1.20 ceph-deploy
13.56.1.21 ceph-node1
13.56.1.22 ceph-node2
Example!!!
ssh-keygen
Create key
ssh-copy-id ceph-admin@ceph-deploy
ssh-copy-id ceph-admin@ceph-node1
ssh-copy-id ceph-admin@ceph-node2
Moves keys
nano ssh-ceph.sh
#!/bin/bash
ssh-copy-id kube@ceph-deploy
ssh-copy-id kube@ceph-node1
ssh-copy-id kube@ceph-node2
*.Install software:
$ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
$ sudo touch /etc/apt/sources.list.d/kubernetes.list
$ echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
$ sudo apt-get update
sudo apt-get install -y docker.io kubelet kubeadm kubectl kubernetes-cni
sudo systemctl enable docker && sudo systemctl start docker
sudo systemctl enable kubelet && sudo systemctl start kubelet
sudo usermod -a -G docker kube
Create ssh env.
ssh-keygen "just hit enter"
copy to all hosts
ssh-copy-id [email protected]
Now Create your kube user and user must be part of docker group
+++ RKE
rke up --config ./rancher-cluster.yml
nodes:
- address: 13.56.1.20
user: kube
role: [controlplane,worker,etcd]
- address: 13.56.1.21
user: kube
role: [controlplane,worker,etcd]
- address: 13.56.1.22
user: kube
role: [controlplane,worker,etcd]
services:
etcd:
snapshot: true
creation: 6h
retention: 24h
network:
plugin: calico
options: {}
cp kube_config_rancher-cluster.yml ~/.kube/config
sudo snap install helm --classic
+++Helm
kubectl -n kube-system create serviceaccount tiller
kubectl create clusterrolebinding tiller --clusterrole cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller
kubectl -n kube-system rollout status deploy/tiller-deploy
kube@sdr-no-micro02:~/rke$ helm repo add rancher-latest https://releases.rancher.com/server-charts/latest
"rancher-latest" has been added to your repositories
kube@sdr-no-micro02:~/rke$ helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
helm install stable/cert-manager --name cert-manager --namespace kube-system
# Issues
kubectl apply -f https://raw.githubusercontent.com/jetstack/cert-manager/release-0.6/deploy/manifests/00-crds.yaml
kubectl label namespace kube-system certmanager.k8s.io/disable-validation=true
helm upgrade cert-manager stable/cert-manager --reuse-values --set webhook.enabled=true
helm install rancher-stable/rancher --name rancher --namespace cattle-system --set hostname=sdr-cont-lab34
helm install stable/percona-xtradb-cluster --namespace db --name rpi-cluster-db
###### Old stuff
helm install rancher-latest/rancher --name rancher --namespace cattle-system --set hostname=sdr-no-micro03.bankservafrica.ent --set proxy="http://kube:[email protected]:8080/" --set proxy="http://kube:[email protected]:8080/"
** helm install rancher-latest/rancher --name rancher --namespace cattle-system --set hostname=rdr-us-coenrad4.bankservafrica.ent --set proxy="http://coenraadl:[email protected]:8080/" --set proxy="https://coenraadl:[email protected]:8080/"
Step 1: Add Rancher Repo into Helm
Source: https://rancher.com/docs/rancher/v2.x/en/installation/install-rancher-on-k8s/
# Add Rancher repo
helm repo add rancher-stable https://releases.rancher.com/server-charts/stable
# Create a namespace for Rancher
kubectl create namespace cattle-system
Step 2: Install CertManager
# Install the CustomResourceDefinition resources separately
kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.0.4/cert-manager.crds.yaml
# Create the namespace for cert-manager
kubectl create namespace cert-manager
# Add the Jetstack Helm repository
helm repo add jetstack https://charts.jetstack.io
# Update your local Helm chart repository cache
helm repo update
# Install the cert-manager Helm chart
helm install \
cert-manager jetstack/cert-manager \
--namespace cert-manager \
--version v1.0.4
Step 3: Install Rancher
hostname=rancher.kimconnect.com
helm install rancher rancher-stable/rancher \
--namespace cattle-system \
--set hostname=$hostname
# Ran into this problem
Error: chart requires kubeVersion: < 1.20.0-0 which is incompatible with Kubernetes v1.20.2
# Workaround: Install K3s instead of K8s
curl -sfL https://get.k3s.io | sh -
# OR
curl https://get.k3s.io | INSTALL_K3S_VERSION=v1.19.7+k3s1 sh - # Install a specific version