Skip to content

Commit

Permalink
Merging conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Mercurio committed Nov 12, 2021
2 parents 8cf8917 + 49eda92 commit 668f3f5
Show file tree
Hide file tree
Showing 15 changed files with 205 additions and 69 deletions.
20 changes: 0 additions & 20 deletions kind/cluster-api/capi-quickstart.kubeconfig

This file was deleted.

3 changes: 0 additions & 3 deletions kind/cluster-api/dockercluster.yaml

This file was deleted.

26 changes: 0 additions & 26 deletions kind/readme.MD

This file was deleted.

20 changes: 20 additions & 0 deletions module9/kind/cluster-api/capi-quickstart.kubeconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM2akNDQWRLZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1URXdOekV5TlRJeE4xb1hEVE14TVRFd05URXlOVGN4TjFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTXE3Ck9VdlgwK09DRkhUU1Q2TWxWcWwvb2FHRGw1VHFrbCswakRBL1BuTm1jR2NWSlhTSUxaSzFoN3l6aGhmRGVhcXMKZmVtc0pxcFdQWnlQYnRHNitqR1NZY0daTVZFL3BYMkpyeElRdVM1Wkl0c05lWGNxQjk5c1NPYnc1VW1ldEZ6cAplMnBRYUo1V1dLc3lLVjkwVjBjclMwN1U4R201Rk00TzRWWXVqL0tYRkJuL3pmL3FkZlNOZy9JQ0tXY1plbWV4Ck9qY042djI0WWJoRjZYMkliOWtOem83UStFcTEzU0xLTEQ5SW9iNHRTeURrN3kzaXQwOURwK1BOZ0ZJN1ljWEQKV1Iva0x4YUVRSGJ0NlBOSUU3L1lLWk9mVE1HTlM2MUE5RWNTNjd4Q3k2ZFBkN1Rxajd5YnEvdkc3Y0ZDZGxrbQovRVJ1UDduUkFtREFXVHoyS3lrQ0F3RUFBYU5GTUVNd0RnWURWUjBQQVFIL0JBUURBZ0trTUJJR0ExVWRFd0VCCi93UUlNQVlCQWY4Q0FRQXdIUVlEVlIwT0JCWUVGSTBYY0pURXNvQ0E1TXdndzVFQlVKMWpYcUxETUEwR0NTcUcKU0liM0RRRUJDd1VBQTRJQkFRQ3FJSllYdEdHeUFaWURBRCtYZkw1MUVCOXFnUVZKZjlwaW1XSTQ5aEwvZzd4Tgo3bWJUbE1XejNkNUE2S0s1STdvNXpYbkFrbi9ISkR3bm93Uk1CaFBCSjFabHdUVnVLMXg3cURVRTg4WXZ5a2FjClQvRVJwbExsL0pGaTA5aW1tSU5CWGZpdGpONGdKQzZjQWNFdklpUS9mdzIva0VON09IQk5wVTlRWTlQSHZOZXMKS1M0THAvQ3M3VXJ1NlE3enRqM0F3bDFHZUhBZ2Z0c1AzWGV1Nk9GQVF2MXhwTFE5VHdKUm9HeTV4QkkxVUJNYQpIR3d3M0FXOFh5d2p4RmRMTmdMN3VtRGwrbnZMditpSkJIa1JkVTJlbGFCT0ZjblFtbWNmOUtjVi9zRmE4cHJ5CklCNFgvdkVpMlVGTmt1ejNhZ2ttTVpGTi94Q2VtVEthcEh1OUFzNy8KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://172.18.0.3:6443
name: capi-quickstart
contexts:
- context:
cluster: capi-quickstart
user: capi-quickstart-admin
name: capi-quickstart-admin@capi-quickstart
current-context: capi-quickstart-admin@capi-quickstart
kind: Config
preferences: {}
users:
- name: capi-quickstart-admin
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURFekNDQWZ1Z0F3SUJBZ0lJWWN1aitJQTA1dVl3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN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V6MTc5eXIwdlJtNVdxV1Z2ZFlEVTV0NWt5cHFadjRvdkgvMkthUjAyT3BqYQpqbWJMQlh5S21hSmVvT29IVWlXMzV2NHVBU3BqbGhtTGdBc01xenh1SWh6K1RMS2tXSUF3Zlphd2tyc3ZVRkt5CnBvMDFJd0tCZ0QrKzBYeUtLMExvcVEycXQvTksrU0tvMDFnb0UwQUtiaGEzak9Ld3F5eGVFTis1RkNaK0UxaisKODNWUE1qTTI5VW9EeWlWK1IyeCszVUdpMnNZSkR2L3BKbCtQendIa3hmdlBsRnhxQzZSVUZnbWdVMXpWTTJEegpiK3QrTzhUR1JrRzVFS2dLOXRVVDdpYUg4MDNub1dwbjlweTlaSXVMcjA4KzFFRUlmTjBPCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: cluster.x-k8s.io/v1alpha4
apiVersion: cluster.x-k8s.io/v1beta1
kind: Cluster
metadata:
name: capi-quickstart
Expand All @@ -13,23 +13,23 @@ spec:
cidrBlocks:
- 10.128.0.0/12
controlPlaneRef:
apiVersion: controlplane.cluster.x-k8s.io/v1alpha4
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
name: capi-quickstart-control-plane
namespace: default
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerCluster
name: capi-quickstart
namespace: default
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerCluster
metadata:
name: capi-quickstart
namespace: default
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: capi-quickstart-control-plane
Expand All @@ -41,15 +41,14 @@ spec:
- containerPath: /var/run/docker.sock
hostPath: /var/run/docker.sock
---
apiVersion: controlplane.cluster.x-k8s.io/v1alpha4
apiVersion: controlplane.cluster.x-k8s.io/v1beta1
kind: KubeadmControlPlane
metadata:
name: capi-quickstart-control-plane
namespace: default
spec:
kubeadmConfigSpec:
clusterConfiguration:
imageRepository: registry.aliyuncs.com/google_containers
apiServer:
certSANs:
- localhost
Expand All @@ -71,14 +70,14 @@ spec:
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
machineTemplate:
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
name: capi-quickstart-control-plane
namespace: default
replicas: 1
version: v1.22.0
version: v1.22.2
---
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
metadata:
name: capi-quickstart-md-0
Expand All @@ -87,7 +86,7 @@ spec:
template:
spec: {}
---
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
metadata:
name: capi-quickstart-md-0
Expand All @@ -100,10 +99,8 @@ spec:
kubeletExtraArgs:
cgroup-driver: cgroupfs
eviction-hard: nodefs.available<0%,nodefs.inodesFree<0%,imagefs.available<0%
clusterConfiguration:
imageRepository: registry.aliyuncs.com/google_containers
---
apiVersion: cluster.x-k8s.io/v1alpha4
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachineDeployment
metadata:
name: capi-quickstart-md-0
Expand All @@ -117,14 +114,14 @@ spec:
spec:
bootstrap:
configRef:
apiVersion: bootstrap.cluster.x-k8s.io/v1alpha4
apiVersion: bootstrap.cluster.x-k8s.io/v1beta1
kind: KubeadmConfigTemplate
name: capi-quickstart-md-0
namespace: default
clusterName: capi-quickstart
infrastructureRef:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha4
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: DockerMachineTemplate
name: capi-quickstart-md-0
namespace: default
version: v1.22.0
version: v1.22.2
Empty file.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
clusterctl generate cluster capi-quickstart --flavor development \
--kubernetes-version v1.22.0 \
--kubernetes-version v1.22.2 \
--control-plane-machine-count=1 \
--worker-machine-count=1 \
> capi-quickstart.yaml
File renamed without changes.
Empty file.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions module9/kind/readme.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
### create host cluster

```
./create_cluster.sh
```

### generate cluster specs

```
cd cluster-api
./init_docker_provider.sh
./generate_workload_cluster.sh
kubectl apply -f capi-quickstart.yaml
```

### check

```
docker ps|grep control-plane
b107b11771e5 kindest/haproxy:v20210715-a6da3463 "haproxy -sf 7 -W -d…" 4 minutes ago Up 4 minutes 40295/tcp, 0.0.0.0:40295->6443/tcp capi-quickstart-lb
clusterctl get kubeconfig capi-quickstart > capi-quickstart.kubeconfig
kubectl get no --kubeconfig capi-quickstart.kubeconfig --server https://127.0.0.1:40295
NAME STATUS ROLES AGE VERSION
capi-quickstart-control-plane-6slwd NotReady control-plane,master 4m19s v1.22.0
capi-quickstart-md-0-765cf784c5-6klwr NotReady <none> 3m41s v1.22.0
```

### kubectl get cluster

### kubectl get machineset
30 changes: 28 additions & 2 deletions module9/kubeadm-ha/1.k8s-ha.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## first master
### reset
```
kubeadm reset
```
### run the following command on all master candidates
### run the following command on 1st master
```
echo "192.168.34.2 cadmin" >> /etc/hosts
echo "192.168.34.2 master.cncamp.io" >> /etc/hosts
Expand All @@ -18,16 +19,41 @@ $ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config
```
### join the 2nd master

### untaint master
```
$ kubectl taint nodes --all node-role.kubernetes.io/master-
```

### install calico cni plugin
https://docs.projectcalico.org/getting-started/kubernetes/quickstart
```
$ kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
$ kubectl create -f https://docs.projectcalico.org/manifests/custom-resources.yaml
```
### second master
### reset
```
kubeadm reset
```
### run the following command on 2nd master
```
echo "192.168.34.2 cadmin" >> /etc/hosts
echo "192.168.34.2 master.cncamp.io" >> /etc/hosts
echo "192.168.34.3 cadmin2" >> /etc/hosts
```
### join the 2nd master
```
kubeadm join master.cncamp.io:6443 --token 2m54gi.0v6s155lujz3ruyk \
--discovery-token-ca-cert-hash sha256:22aee251c9a2ea7442862555ed6fce301f44548069e46bfad9210aaffa4f1cef \
--control-plane --certificate-key 8a4d46120ad3eaa63b6e3395a59b4ef8c84eb90c2ef7aa375e707086959fa72b \
--apiserver-advertise-address=192.168.34.3
```


ETCDCTL_API=3
etcdctl --endpoints https://192.168.34.2:2379 \
--cacert /etc/kubernetes/pki/etcd/ca.crt \
--cert /etc/kubernetes/pki/etcd/server.crt \
--key /etc/kubernetes/pki/etcd/server.key \
member list
12 changes: 12 additions & 0 deletions module9/kubeadm-ha/kubeadm-conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ etcd:
# one of local or external
local:
dataDir: "/var/lib/etcd"
serverCertSANs:
- "127.0.0.1"
- "192.168.34.2"
- "192.168.34.3"
- "localhost"
- "master.cncamp.io"
peerCertSANs:
- "127.0.0.1"
- "192.168.34.2"
- "192.168.34.3"
- "localhost"
- "master.cncamp.io"
networking:
podSubnet: "192.168.0.0/16"
dnsDomain: "cluster.local"
Expand Down
Loading

0 comments on commit 668f3f5

Please sign in to comment.