学习2.3.2 Deploy TiDB in Kubernetes(在 Kubernetes 上部署 TiDB 集群)

课程名称:课程版本(101/201/301)+ 课程名称

2.3.2 Deploy TiDB in Kubernetes(在 Kubernetes 上部署 TiDB 集群)

30min

课程收获:

课程内容:

本课程简要介绍了 Kubernetes 的基本概念,详细描述了 TiDB Operator 的实现原理以及如何在 Kubernetes 集群上部署 TiDB 集群。
学习目标: 了解 Kubernetes 基本概念,理解 TiDB Operator 原理,了解如何部署 TiDB 集群

学习过程中遇到的问题或延伸思考:

  1. Kubernetes用到技术
    cgroups 控制resource
    Namespace 隔离containers
    Rootfs container之根基

etcd K-V store
Kubernete-controller manager node, deployment,statefulset service controller , Kubernete-api-server , Kubernete-sheduler 调度pod,
addons: CNI,DNS,dashboard

kubenet:
kube-proxy:网络规则on nodes
Contauner Runtime(docker)

PoD: a set of container -> VM a set of processes
service Types:
cluster IP
NodePort
LoadBalancer
ExternalName

service web:
app=A
cluster IP:
port: 80
Nodeport:32336
ExternalName

PV & PVC
persistent volume claim
–100G
–selector
–storageclassname
Workload
deployment: stateless app
declarative updates for Pods and ReplicaSets
StatefulSets: for stateful applications 有状态的
Stable, unique network identifiers
podName.headlessServiceName.namespace.svc.cluster.local
Stable, Persitent storage
Ordered,graceful deployment scaling : scale-out/in
Ordered,automated rolling updates : 滚动升级
Daemon Set
Jobs
Crontab

Controller:
observe
desired state current state
adjust

TiDB Operator
Kubernete Custom Resource Definition(CRD)
Analogy: Class Definition and Class Instance (Object) in OOP

kube-scheduler tidb-scheduler

kubectl apply -f url #CRD
kubectl get crd |grep tidbclusters
kubectl get po -n tidb-admin

CRD
Configure TiDB clusterCR
Apply TiDB CR

etcd dicovery – TIDB-discovery
kubectl get svc

kubectl port-forward svc/basic-tidb 4000:4000
mysql -uroot -p -P 4000 -h 127.0.0.1
In K8S cluster
mysql -uroot -p -P 4000 -h cluster_innerIP
mysql -uroot -p -P 4000 -h basic-tidb.default (in Pod)
Out of K8S cluster
mysql -uroot -p -P 32136 -h outerIP (Node POD)

学习过程中参考的其他资料