姒傝堪
鍦ㄤ紶缁熺殑铏氭満/鐗╃悊鏈虹幆澧冮噷, 濡傛灉鎴戜滑鎯宠瀵逛竴涓湁鐘舵€佸簲鐢ㄦ墿瀹? 鎴戜滑闇€瑕佸仛鍝簺姝ラ
- 鐢宠铏氭満/鐗╃悊鏈?/li>
- 瀹夎渚濊禆
- 涓嬭浇瀹夎鍖?/li>
- 鎸夎鑼冮厤缃富鏈哄悕, hosts
- 閰嶇疆缃戠粶: 鍖呮嫭鍩熷悕, DNS, 铏?ip, 闃茬伀澧?..
- 閰嶇疆鐩戞帶
浠婂ぉ铏氭満鐜涓婂嚭鐜颁簡闂, 鏄洜涓?RabbitMQ 璧勬簮涓嶈冻. 鎵嬪姩鎵╁鐨勮繃绋嬩腑鑺辫垂浜嗚緝闀跨殑鏃堕棿.
浣嗘槸鍦?K8S 涓? 鏈夌姸鎬佸簲鐢ㄧ殑鎵╁灏卞緢绠€鍗? YAML 閲屾敼涓€涓?code>replicas鍓湰鏁? 绛変笉鍒?1min 灏辨墿瀹瑰畬姣?
褰撶劧, 鏈€鍩烘湰鐨? 涓嬮暅鍍? 鍚姩 pod(鐩稿綋浜庝笂杈圭殑鍓?3 姝?, 灏变笉蹇呭鎻? 閭d箞, 杩樻湁鍝簺鍥犵礌, 璁╂湁鐘舵€佸簲鐢ㄥ彲浠ュ湪 k8s 涓婂揩閫熸墿瀹圭敋鑷宠嚜鍔ㄦ墿瀹瑰憿
鍘熷洜灏辨槸杩欎袱鐐?
- peer discovery +peer discovery 鐨?鐩稿叧瀹炵幇(閫氳繃 hostname, dns, k8s api 鎴栧叾浠?
- 鍙瀵熸€?+ 鑷姩浼哥缉
鎴戜滑浠婂ぉ閫夋嫨鍑犱釜鍏稿瀷鐨勬湁鐘舵€佸簲鐢? 涓€涓€姊崇悊涓?
- Eureka
- Nacos
- Redis
- RabbitMQ
- Kafka
- TiDB
K8S 涓婃湁鐘舵€佸簲鐢ㄦ墿瀹?/h2>
鍦?Kubernetes 涓? 鏈夌姸鎬佸簲鐢ㄥ揩閫熸墿瀹圭敋鑷宠嚜鍔ㄦ墿瀹瑰緢瀹规槗. 杩欏緱鐩婁簬 Kubernetes 浼樼鐨勮璁′互鍙婅壇濂界殑鐢熸€? Kubernetes 灏卞儚鏄竴涓簯鍘熺敓鏃朵唬鐨勬搷浣滅郴缁? 瀹冭嚜韬氨鍏锋湁:
- 鑷姩鍖栧伐鍏?
- 鍐呴儴鏈嶅姟鍙戠幇 + 璐熻浇鍧囪
- 鍐呴儴 DNS
- 鍜?Prometheus 鏁村悎
- 缁熶竴鐨勫0鏄庡紡 API
- 鏍囧噯, 寮€婧愮殑鐢熸€佺幆澧?
鎵€浠? 闇€瑕佹墿瀹? 涓€涓?yaml 鎼炲畾鍏ㄩ儴. 鍖呮嫭涓婅竟鎻愬埌鐨? 涓嬭浇, 瀹夎, 瀛樺偍閰嶇疆, 鑺傜偣鍙戠幇, 鍔犲叆闆嗙兢, 鐩戞帶閰嶇疆...
Eureka 鎵╁
馃敄 澶囨敞:
鏈夌姸鎬佹墿瀹圭涓€灞?
StatefulSet + Headless Service
eureka 鐨勬墿瀹瑰湪 K8S 鏈夌姸鎬佸簲鐢ㄤ腑鏄渶绠€鍗曠殑, 灏辨槸:
headless service + statefulset
Eureka 瑕佹墿瀹? 鍙 eureka 瀹炰緥褰兼鑳界浉浜掑彂鐜板氨鍙互. headless service
鍦ㄨ繖绉嶆儏鍐典笅灏辨淳涓婄敤鍦轰簡, 灏辨槸璁╁郊姝ゅ彂鐜?
Eureka 鐨勪竴涓畬鏁撮泦缇?yaml, 濡備笅:璇︾粏璇存槑濡備笅:
apiVersion: v1
kind: Service
metadata:
name: eureka
namespace: ms
spec:
clusterIP: None
ports:
- name: eureka
port: 8888
selector:
project: ms
app: eureka
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: eureka
namespace: ms
spec:
serviceName: eureka
replicas: 3
selector:
matchLabels:
project: ms
app: eureka
template:
metadata:
labels:
project: ms
app: eureka
spec:
terminationGracePeriodSeconds: 10
imagePullSecrets:
- name: registry-pull-secret
containers:
- name: eureka
image: registry.example.com/kubernetes/eureka:latest
ports:
- protocol: TCP
containerPort: 8888
env:
- name: APP_NAME
value: "eureka"
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: APP_OPTS
value: "
--eureka.instance.hostname=${POD_NAME}.${APP_NAME}
--registerWithEureka=true
--fetchRegistry=true
--eureka.instance.preferIpAddress=false
--eureka.client.serviceUrl.defaultZone=http://eureka-0.${APP_NAME}:8888/eureka/,http://eureka-1.${APP_NAME}:8888/eureka/,http://eureka-2.${APP_NAME}:8888/eureka/
- 閰嶇疆鍚嶄负
eureka
鐨?Service - 鍦ㄥ悕涓?code>eureka鐨?statefulset 閰嶇疆涓?鍏?3 涓?eureka 鍓湰, 姣忎釜 eureka 鐨?HOSTNAME 涓?
${POD_NAME}.${SERVICE_NAME}
. 濡?eureka-0.eureka
- 褰兼閫氳繃
--registerWithEureka=true --fetchRegistry=true --eureka.instance.preferIpAddress=false --eureka.client.serviceUrl.defaultZone=http://eureka-0.${APP_NAME}:8888/eureka/,http://eureka-1.${APP_NAME}:8888/eureka/,http://eureka-2.${APP_NAME}:8888/eureka/
閫氳繃 HOSTNAME 鐩镐簰娉ㄥ唽, 瀹屾垚浜嗛泦缇ょ殑鍒涘缓.
閭d箞, 濡傛灉瑕佸揩閫熸墿瀹瑰埌 5 涓?
- 璋冩暣 StatefulSet:
replicas: 5
- 鍦ㄧ幆澧冨彉閲?code>APP_OPTS涓姞鍏ユ柊澧炵殑 2 涓壇鏈?hostname:
http://eureka-3.${APP_NAME}:8888/eureka/,http://eureka-4.${APP_NAME}:8888/eureka/
鍗冲彲瀹屾垚.
Headless Service
鏈夋椂涓嶉渶瑕佹垨涓嶆兂瑕佽礋杞藉潎琛★紝浠ュ強鍗曠嫭鐨?Service IP銆?閬囧埌杩欑鎯呭喌锛屽彲浠ラ€氳繃鎸囧畾 Cluster IP锛?code>spec.clusterIP锛夌殑鍊间负 None
鏉ュ垱寤?Headless Service銆?/p>
鎮ㄥ彲浠ヤ娇鐢ㄦ棤澶?Service 涓庡叾浠栨湇鍔″彂鐜版満鍒惰繘琛屾帴鍙o紝鑰屼笉蹇呬笌 Kubernetes 鐨勫疄鐜版崋缁戝湪涓€璧枫€?/p>
瀵硅繖鏃犲ご Service 骞朵笉浼氬垎閰?Cluster IP锛宬ube-proxy 涓嶄細澶勭悊瀹冧滑锛?鑰屼笖骞冲彴涔熶笉浼氫负瀹冧滑杩涜璐熻浇鍧囪 鍜岃矾鐢便€?DNS 濡備綍瀹炵幇鑷姩閰嶇疆锛屼緷璧栦簬 Service 鏄惁瀹氫箟浜嗛€夋嫨绠楃銆?/p>
Nacos
馃敄 澶囨敞:
鏈夌姸鎬佹墿瀹圭浜屽眰:
StatefulSet + Headless Service + Init Container(鑷姩鍖栧彂鐜? + PVC
鐩告瘮 Eureka, nacos 閫氳繃涓€涓?code>init container,(杩欎釜 init container, 灏辨槸涓€涓嚜鍔ㄥ寲鐨?peer discovery 鑴氭湰.) , 瀹炵幇浜嗕竴琛屽懡浠ゅ揩閫熸墿瀹?
kubectl scale sts nacos --replicas=3
鑴氭湰閾炬帴涓? https://github.com/nacos-group/nacos-k8s/tree/master/plugin/peer
鎵╁鐨勭浉鍏宠嚜鍔ㄥ寲鎿嶄綔涓?
- 浠?Headless Service 鑷姩鍙戠幇鎵€鏈夌殑 replicas 鐨?HOSTNAME;
- 骞跺皢 HOSTNAME 鍐欏叆鍒?
${CLUSTER_CONF}
杩欎釜鏂囦欢涓? -
${CLUSTER_CONF}
杩欎釜鏂囦欢灏辨槸 nacos 闆嗙兢鐨勬墍鏈?member 淇℃伅. 灏嗘柊鍐欏叆 HOSTNAME 鐨勫疄渚嬪姞鍏ュ埌 nacos 闆嗙兢涓?
鍦ㄨ繖閲? 閫氳繃 Headless Service 鍜?PV/PVC(瀛樺偍 nacos 鎻掍欢鎴栧叾浠栨暟鎹?锛屽疄鐜颁簡瀵?Pod 鐨勬嫇鎵戠姸鎬佸拰瀛樺偍鐘舵€佺殑缁存姢锛屼粠鑰岃鐢ㄦ埛鍙互鍦?Kubernetes 涓婅繍琛屾湁鐘舵€佺殑搴旂敤銆?/p>
鐒惰€?Statefullset 鍙兘鎻愪緵鍙楅檺鐨勭鐞嗭紝閫氳繃 StatefulSet 鎴戜滑杩樻槸闇€瑕佺紪鍐欏鏉傜殑鑴氭湰(濡?nacos 鐨?code>peer-finder鐩稿叧鑴氭湰), 閫氳繃鍒ゆ柇鑺傜偣缂栧彿鏉ュ尯鍒妭鐐圭殑鍏崇郴鍜屾嫇鎵戯紝闇€瑕佸叧蹇冨叿浣撶殑閮ㄧ讲宸ヤ綔銆?/p>
RabbitMQ
馃敄 澶囨敞:
鏈夌姸鎬佹墿瀹圭涓夊眰:
StatefulSet + Headless Service + 鎻掍欢(鑷姩鍖栧彂鐜板拰鐩戞帶) + PVC
RabbitMQ 鐨勯泦缇ゅ彲浠ュ弬鑰冭繖杈瑰畼鏂规枃妗? Cluster Formation and Peer Discovery
杩欓噷鎻愬埌鐨? 鍔ㄦ€佺殑鍙戠幇鏈哄埗闇€瑕佷緷璧栧閮ㄧ殑鏈嶅姟, 濡? DNS, API(AWS 鎴?K8S).
瀵逛簬 Kubernetes, 浣跨敤鐨勫姩鎬佸彂鐜版満鍒舵槸鍩轰簬rabbitmq-peer-discovery-k8s鎻掍欢 瀹炵幇鐨?
閫氳繃杩欑鏈哄埗锛岃妭鐐瑰彲浠ヤ娇鐢ㄤ竴缁勯厤缃殑鍊间粠 Kubernetes API 绔偣鑾峰彇鍏跺绛夋柟鐨勫垪琛細URI 妯″紡锛屼富鏈猴紝绔彛浠ュ強浠ょ墝鍜岃瘉涔﹁矾寰勩€?/p>
鍙﹀, rabbitmq 闀滃儚涔熼粯璁ら泦鎴愪簡鐩戞帶鐨勬彃浠?- rabbitmq_prometheus.
褰撶劧, 閫氳繃Helm Chart
涔熻兘涓€閿儴缃插拰鎵╁.
Helm Chart
涓€鍙ヨ瘽姒傛嫭, Helm 涔嬩簬 Kubernetes, 鐩稿綋浜?yum 涔嬩簬 centos. 瑙e喅浜嗕緷璧栫殑闂. 灏嗛儴缃?rabbitmq 杩欎箞澶嶆潅鐨勮蒋浠舵墍闇€瑕佺殑涓€澶у爢 yaml, 閫氳繃鍙傛暟鍖栨娊璞″嚭蹇呰鐨勫弬鏁?骞朵笖鎻愪緵榛樿鍙傛暟)鏉ュ揩閫熼儴缃?
Redis
馃敄 澶囨敞:
鏈夌姸鎬佹墿瀹圭鍥涘眰:
閫氳繃 Operator 缁熶竴缂栨帓鍜岀鐞?
Deployment(鍝ㄥ叺) + StatefulSet + Headless Service + Sidecar Container(鐩戞帶) + PVC
杩欓噷浠?UCloud 寮€婧愮殑: redis-operator 涓轰緥. 瀹冩槸鍩轰簬 鍝ㄥ叺妯″紡 鐨?redis 闆嗙兢.
浜庝箣鍓嶇殑 StatefulSet + Headless 涓嶅悓, 杩欓噷鐢ㄥ埌浜嗕竴椤规柊鐨?K8S 鎶€鏈? operator
.
Operator 鍘熺悊
馃摉 璇存槑:
瑙i噴 Operator 涓嶅緱涓嶆彁 Kubernetes 涓袱涓渶鍏蜂环鍊肩殑鐞嗗康锛氣€滃0鏄庡紡 API鈥?鍜?鈥滄帶鍒跺櫒妯″紡鈥濄€傗€滃0鏄庡紡 API鈥濈殑鏍稿績鍘熺悊灏辨槸褰撶敤鎴峰悜 Kubernetes 鎻愪氦浜嗕竴涓?API 瀵硅薄鐨勬弿杩颁箣鍚庯紝Kubernetes 浼氳礋璐d负浣犱繚璇佹暣涓泦缇ら噷鍚勯」璧勬簮鐨勭姸鎬侊紝閮戒笌浣犵殑 API 瀵硅薄鎻忚堪鐨勯渶姹傜浉涓€鑷淬€侹ubernetes 閫氳繃鍚姩涓€绉嶅彨鍋氣€滄帶鍒跺櫒妯″紡鈥濈殑鏃犻檺寰幆锛學ATCH 杩欎簺 API 瀵硅薄鐨勫彉鍖栵紝涓嶆柇妫€鏌ワ紝鐒跺悗璋冭皭锛屾渶鍚庣‘淇濇暣涓泦缇ょ殑鐘舵€佷笌杩欎釜 API 瀵硅薄鐨勬弿杩颁竴鑷淬€?/p>
姣斿 Kubernetes 鑷甫鐨勬帶鍒跺櫒锛欴eployment锛屽鏋滄垜浠兂鍦?Kubernetes 涓儴缃插弻鍓湰鐨?Nginx 鏈嶅姟锛岄偅涔堟垜浠氨瀹氫箟涓€涓?repicas 涓?2 鐨?Deployment 瀵硅薄锛孌eployment 鎺у埗鍣?WATCH 鍒版垜浠殑瀵硅薄鍚庯紝閫氳繃鎺у埗寰幆锛屾渶缁堜細甯垜浠湪 Kubernetes 鍚姩涓や釜 Pod銆?/p>
Operator 鏄悓鏍风殑閬撶悊锛屼互鎴戜滑鐨?Redis Operator 涓轰緥锛屼负浜嗗疄鐜?Operator锛屾垜浠鍏堥渶瑕佸皢鑷畾涔夊璞$殑璇存槑娉ㄥ唽鍒?Kubernetes 涓紝杩欎釜瀵硅薄鐨勮鏄庡氨鍙?CustomResourceDefinition锛圕RD锛夛紝瀹冪敤浜庢弿杩版垜浠?Operator 鎺у埗鐨勫簲鐢細redis 闆嗙兢锛岃繖涓€姝ユ槸涓轰簡璁?Kubernetes 鑳藉璁よ瘑鎴戜滑搴旂敤銆傜劧鍚庨渶瑕佸疄鐜拌嚜瀹氫箟鎺у埗鍣ㄥ幓 WATCH 鐢ㄦ埛鎻愪氦鐨?redis 闆嗙兢瀹炰緥锛岃繖鏍峰綋鐢ㄦ埛鍛婅瘔 Kubernetes 鎴戞兂瑕佷竴涓?redis 闆嗙兢瀹炰緥鍚庯紝Redis Operator 灏辫兘澶熼€氳繃鎺у埗寰幆鎵ц璋冭皭閫昏緫杈惧埌鐢ㄦ埛瀹氫箟鐘舵€併€?/p>
绠€鍗曡, operator 鍙互缈昏瘧涓? 杩愮淮浜猴紙鎿嶄綔鍛橈級 . 灏辨槸灏嗛珮绾у師鍘傝繍缁翠笓瀹跺骞寸殑缁忛獙, 娴撶缉涓轰竴涓? 浣跨敤 Redis Operator 鎴戜滑鍙互寰堟柟渚跨殑璧蜂竴涓摠鍏垫ā寮忕殑闆嗙兢锛岄泦缇ゅ彧鏈変竴涓?Master 鑺傜偣锛屽涓?Slave 鑺傜偣锛屽亣濡傛寚瀹?Redis 闆嗙兢鐨?size 涓?3锛岄偅涔?Redis Operator 灏变細甯垜浠惎鍔ㄤ竴涓?Master 鑺傜偣锛屼袱涓?Salve 鑺傜偣锛屽悓鏃跺惎鍔ㄤ笁涓?Sentinel 鑺傜偣鏉ョ鐞?Redis 闆嗙兢锛?/p>
Redis Operator 閫氳繃 Statefulset 绠$悊 Redis 鑺傜偣锛岄€氳繃 Deployment 鏉ョ鐞?Sentinel 鑺傜偣锛岃繖姣旂鐞嗚8 Pod 瑕佸鏄擄紝鑺傜渷瀹炵幇鎴愭湰銆傚悓鏃跺垱寤轰竴涓?Service 鎸囧悜鎵€鏈夌殑鍝ㄥ叺鑺傜偣锛岄€氳繃 Service 瀵瑰鎴风鎻愪緵鏌ヨ Master銆丼lave 鑺傜偣鐨勬湇鍔°€傛渶缁堬紝Redis Operator 鎺у埗寰幆浼氳皟璋愰泦缇ょ殑鐘舵€侊紝璁剧疆闆嗙兢鐨勬嫇鎵戯紝璁╂墍鏈夌殑 Sentinel 鐩戞帶鍚屼竴涓?Master 鑺傜偣锛岀洃鎺х浉鍚岀殑 Salve 鑺傜偣锛孯edis Operator 闄や簡浼?WATCH 瀹炰緥鐨勫垱寤恒€佹洿鏂般€佸垹闄や簨浠讹紝杩樹細瀹氭椂妫€娴嬪凡鏈夌殑闆嗙兢鐨勫仴搴风姸鎬侊紝瀹炴椂鎶婇泦缇ょ殑鐘舵€佽褰曞埌 鍚屾椂, 杩樻彁渚涗簡蹇€熸寔涔呭寲, 鐩戞帶, 鑷姩鍖?redis 闆嗙兢閰嶇疆鐨勮兘鍔? 鍙渶涓€涓?yaml 鍗冲彲瀹炵幇: 瑕佹墿瀹逛篃寰堢畝鍗? 灏嗕笂杈圭殑 馃敄 澶囨敞: 鏈夌姸鎬佹墿瀹圭浜斿眰: 閫氳繃 Operator 缁熶竴缂栨帓鍜岀鐞嗗涓湁鐘舵€佺粍浠剁殑: StatefulSet + Headless Service + ... + 鐩戞帶 杩欓噷浠?Strimzi 涓轰緥 - Strimzi Overview guide (0.20.0). 杩欐槸涓€涓?Kafka 鐨?Operator. 鎻愪緵浜?Apache Kafka 缁勪欢浠ラ€氳繃 Strimzi 鍙戣鐗堥儴缃插埌 Kubernetes銆?Kafka 缁勪欢閫氬父浠ラ泦缇ょ殑褰㈠紡杩愯浠ユ彁楂樺彲鐢ㄦ€с€?/p>
鍖呭惈 Kafka 缁勪欢鐨勫吀鍨嬮儴缃插彲鑳藉寘鎷細 Kafka 鐨勭粍浠舵灦鏋勬瘮杈冨鏉? 鍏蜂綋濡備笅: 閫氳繃 Operator, 涓€涓?YAML 鍗冲彲瀹屾垚涓€濂楀鏉傜殑閮ㄧ讲: 褰撶劧, 鐢变簬 Kafka 鐨勭壒娈婃€? 濡傛灉瑕佸皢鏂板鐨?brokers 娣诲姞鍒扮幇鏈夐泦缇? 杩橀渶瑕侀噸鏂板垎鍖? 杩欓噷杈规秹鍙婄殑鏇村鎿嶄綔璇﹁: Scaling Clusters - Using Strimzi 馃敄 澶囨敞: 鏈夌姸鎬佹墿瀹圭鍏眰: 閫氳繃 Operator 缁熶竴缂栨帓鍜岀鐞嗗涓湁鐘舵€佺粍浠剁殑: StatefulSet + Headless Service + ... + 鐩戞帶 + TidbClusterAutoScaler(绫讳技 HPA 鐨勫疄鐜? 鐢氳嚦鑳藉仛鍒板浠藉拰鐏鹃毦鎭㈠. TiDB 鏇磋繘涓€姝? 鍙互瀹炵幇 鏈夌姸鎬佸簲鐢ㄨ嚜鍔ㄦ墿瀹?/strong>. 鍏蜂綋瑙佽繖閲? Enable TidbCluster Auto-scaling | PingCAP Docs Kubernetes 鎻愪緵浜?code>Horizontal Pod Autoscaler 锛岃繖鏄竴绉嶅熀浜?CPU 鍒╃敤鐜囩殑鍘熺敓 API銆?TiDB 4.0 鍩轰簬 Kubernetes锛屽疄鐜颁簡寮规€ц皟搴︽満鍒躲€?/p>
鍙渶瑕佸惎鐢ㄦ鍔熻兘鍗冲彲浣跨敤: TiDB 瀹炵幇浜嗕竴涓?code>TidbClusterAutoScaler CR 瀵硅薄鐢ㄤ簬鎺у埗 TiDB 闆嗙兢涓嚜鍔ㄧ缉鏀剧殑琛屼负銆?濡傛灉鎮ㄤ娇鐢ㄨ繃 闇€瑕佹寚鍑虹殑鏄? 闇€瑕佸悜 閫氳繃 6 涓湁鐘舵€佽蒋浠? 鎴戜滑瑙佽瘑鍒颁簡灞傚眰閫掕繘鐨?K8S 涓婃湁鐘舵€佸簲鐢ㄧ殑蹇€熸墿瀹圭敋鑷虫槸鑷姩鎵╁: 馃槀馃槀馃槀 瑙f斁寮€鍙戝拰杩愮淮鎵撳伐浜?/strong>, 鏄椂鍊欏湪 K8S 涓婇儴缃叉湁鐘舵€佽蒋浠朵簡! 馃挭馃挭馃挭 涓変汉琛? 蹇呮湁鎴戝笀; 鐭ヨ瘑鍏变韩, 澶╀笅涓哄叕. 鏈枃鐢变笢椋庡井楦f妧鏈崥瀹?EWhisper.cn 缂栧啓.operator
. 閭d箞, 鎴戜滑鎵€鏈夌殑 杩愮淮鎵撳伐浜?/strong> 灏变笉闇€瑕佸啀鑻﹀搱鍝堢殑"浠庨浂寮€濮嬫惌寤?xxx 闆嗙兢", 鑰屾槸閫氳繃杩欎釜鍙墿灞曘€佸彲閲嶅銆佹爣鍑嗗寲銆佺敋鑷冲叏鐢熷懡鍛ㄦ湡杩愮淮绠$悊鐨?code>operator銆?鏉ュ畬鎴愬鏉傝蒋浠剁殑瀹夎锛屾墿瀹癸紝鐩戞帶, 澶囦唤鐢氳嚦鏁呴殰鎭㈠銆?/p>
Redis Operator
spec.status.conditions
涓?apiVersion: redis.kun/v1beta1
kind: RedisCluster
metadata:
name: redis
spec:
config: # redis闆嗙兢閰嶇疆
maxmemory: 1gb
maxmemory-policy: allkeys-lru
password: sfdfghc56s # redis瀵嗙爜閰嶇疆
resources: # redis璧勬簮閰嶇疆
limits:
cpu: '1'
memory: 1536Mi
requests:
cpu: 250m
memory: 1Gi
size: 3 # redis鍓湰鏁伴厤缃?
storage: # 鎸佷箙鍖栧瓨鍌ㄩ厤缃?
keepAfterDeletion: true
persistentVolumeClaim:
metadata:
name: redis
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
storageClassName: nfs
volumeMode: Filesystem
sentinel: # 鍝ㄥ叺閰嶇疆
image: 'redis:5.0.4-alpine'
exporter: # 鍚敤鐩戞帶
enabled: true
size: 3
鎸夐渶璋冩暣鍗冲彲. 璋冩暣鍚? 鑷姩鐢宠璧勬簮, 鎵╁, 鍔犲瓨鍌? 鏀?redis 閰嶇疆, 鍔犲叆 redis 闆嗙兢, 骞朵笖鑷姩娣诲姞鐩戞帶.Kafka
apiVersion: kafka.strimzi.io/v1beta1
kind: Kafka
metadata:
name: my-cluster
spec:
kafka:
replicas: 3
version: 0.20.0
resources:
requests:
memory: 64Gi
cpu: "8"
limits:
memory: 64Gi
cpu: "12"
jvmOptions:
-Xms: 8192m
-Xmx: 8192m
listeners:
- name: plain
port: 9092
type: internal
tls: false
useServiceDnsDomain: true
- name: tls
port: 9093
type: internal
tls: true
authentication:
type: tls
- name: external
port: 9094
type: route
tls: true
configuration:
brokerCertChainAndKey:
secretName: my-secret
certificate: my-certificate.crt
key: my-key.key
authorization:
type: simple
config:
auto.create.topics.enable: "false"
offsets.topic.replication.factor: 3
transaction.state.log.replication.factor: 3
transaction.state.log.min.isr: 2
ssl.cipher.suites: "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384" (17)
ssl.enabled.protocols: "TLSv1.2"
ssl.protocol: "TLSv1.2"
storage:
type: persistent-claim
size: 10000Gi
rack:
topologyKey: topology.kubernetes.io/zone
metrics:
lowercaseOutputName: true
rules:
# Special cases and very specific rules
- pattern : kafka.server<type=(.+), name=(.+), clientId=(.+), topic=(.+), partition=(.*)><>Value
name: kafka_server__
type: GAUGE
labels:
clientId: ""
topic: ""
partition: ""
# ...
zookeeper:
replicas: 3
resources:
requests:
memory: 8Gi
cpu: "2"
limits:
memory: 8Gi
cpu: "2"
jvmOptions:
-Xms: 4096m
-Xmx: 4096m
storage:
type: persistent-claim
size: 1000Gi
metrics:
# ...
entityOperator:
topicOperator:
resources:
requests:
memory: 512Mi
cpu: "1"
limits:
memory: 512Mi
cpu: "1"
userOperator:
resources:
requests:
memory: 512Mi
cpu: "1"
limits:
memory: 512Mi
cpu: "1"
kafkaExporter:
# ...
cruiseControl:
# ...
TiDB
features:
- AutoScaling=true
Horizontal Pod Autoscaler
锛屽ぇ姒傛槸鎮ㄧ啛鎮?TidbClusterAutoScaler 姒傚康銆?浠ヤ笅鏄?TiKV 涓殑鑷姩缂╂斁绀轰緥銆?/p>
apiVersion: pingcap.com/v1alpha1
kind: TidbClusterAutoScaler
metadata:
name: auto-scaling-demo
spec:
cluster:
name: auto-scaling-demo
namespace: default
monitor:
name: auto-scaling-demo
namespace: default
tikv:
minReplicas: 3
maxReplicas: 4
metrics:
- type: "Resource"
resource:
name: "cpu"
target:
type: "Utilization"
averageUtilization: 80
TidbClusterAutoScaler
鎻愪緵鎸囨爣鏀堕泦鍜屾煡璇?鐩戞帶)鏈嶅姟锛屽洜涓哄畠閫氳繃鎸囨爣鏀堕泦缁勪欢鎹曡幏璧勬簮浣跨敤鎯呭喌銆?monitor 灞炴€у紩鐢?code>TidbMonitor 瀵硅薄(鍏跺疄灏辨槸鑷姩鍖栧湴閰嶇疆 TiDB 鐨?prometheus 鐩戞帶鍜屽睍绀虹瓑)銆?鏈夊叧鏇村淇℃伅锛岃鍙傝浣跨敤TidbMonitor鐩戣TiDB缇ら泦銆?/p>
鎬荤粨