From 67e33c4eb843fc4ed7dc59ce6ae09e3ccca42f33 Mon Sep 17 00:00:00 2001 From: gjmzj Date: Tue, 9 Feb 2021 17:40:04 +0800 Subject: [PATCH] add etcd config flags --- example/config.yml | 8 ++++++++ .../templates/metrics-server/components.yaml | 2 +- roles/etcd/templates/etcd.service.j2 | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/example/config.yml b/example/config.yml index ef58c8c..03bed5f 100644 --- a/example/config.yml +++ b/example/config.yml @@ -30,6 +30,14 @@ CLUSTER_NAME: "cluster1" CONTEXT_NAME: "context-{{ CLUSTER_NAME }}" +############################ +# role:etcd +############################ +# 设置不同的wal目录,可以避免磁盘io竞争,提高性能 +ETCD_DATA_DIR: "/var/lib/etcd" +ETCD_WAL_DIR: "" + + ############################ # role:runtime [containerd,docker] ############################ diff --git a/roles/cluster-addon/templates/metrics-server/components.yaml b/roles/cluster-addon/templates/metrics-server/components.yaml index 0576848..76395eb 100644 --- a/roles/cluster-addon/templates/metrics-server/components.yaml +++ b/roles/cluster-addon/templates/metrics-server/components.yaml @@ -39,7 +39,7 @@ subjects: name: metrics-server namespace: kube-system --- -apiVersion: apiregistration.k8s.io/v1beta1 +apiVersion: apiregistration.k8s.io/v1 kind: APIService metadata: name: v1beta1.metrics.k8s.io diff --git a/roles/etcd/templates/etcd.service.j2 b/roles/etcd/templates/etcd.service.j2 index 78b07fe..d602f0e 100644 --- a/roles/etcd/templates/etcd.service.j2 +++ b/roles/etcd/templates/etcd.service.j2 @@ -23,11 +23,12 @@ ExecStart={{ bin_dir }}/etcd \ --initial-cluster-token=etcd-cluster-0 \ --initial-cluster={{ ETCD_NODES }} \ --initial-cluster-state={{ CLUSTER_STATE }} \ - --data-dir=/var/lib/etcd \ + --data-dir={{ ETCD_DATA_DIR }} \ + --wal-dir={{ ETCD_WAL_DIR }} \ --snapshot-count=50000 \ --auto-compaction-retention=1 \ - --max-request-bytes=10485760 \ --auto-compaction-mode=periodic \ + --max-request-bytes=10485760 \ --quota-backend-bytes=8589934592 Restart=always RestartSec=15