اگر یکی از اعضای etcd منابع بیشتری که از مقدار quota تعریف شده مصرف کند، یک هشدار (alarm) ایجاد میشود که etcd را در حالت تعمیر و نگهداری با عملیات محدود قرار میدهد. برای جلوگیری از پر شدن فضا، تاریخچه فضای کلید etcd به صورت خودکار توسط خود etcd فشرده (compact) میشود.\u003C/p>","adcb76a4-38f4-4f8c-a7de-09098fd4090a",{"type":1113,"value":1123,"id":1126},{"heading_text":1124,"size":1116,"link_id":1125},"راهاندازی مانیتورینگ برای etcd","setup-etcd-monitoring","88ec581e-1e1d-4ffd-a5dd-d4799bb67cca",{"type":1103,"value":1128,"id":1129},"\u003Cp data-block-key=\"z4w3d\">مانیتورینگ etcd برای اطمینان از سلامت و عملکرد کلاستر بسیار مهم است. این راهنما دستورالعملهای گامبهگام برای تنظیم مانیتورینگ etcd و بررسی روشهای مختلف برای انجام این کار را ارائه میدهد.\u003C/p>","4a833191-9409-47bd-93fa-bc0016e9eb27",{"type":1113,"value":1131,"id":1135},{"heading_text":1132,"size":1133,"link_id":1134},"گام ۱: دسترسی به سرتیفیکیتهای etcd","h3","step1","8310301d-95ce-43d8-b348-e372376daf72",{"type":1113,"value":1137,"id":1141},{"heading_text":1138,"size":1139,"link_id":1140},"۱- یافتن پاد etcd","h4","find-etcdpod","4d79ac86-91e7-4424-b9d1-02c28051959e",{"type":1103,"value":1143,"id":1144},"\u003Cp data-block-key=\"88z5c\">ابتدا پاد etcd را در کنترل پلین شناسایی کنید.\u003C/p>","c823fc6e-7bec-48c1-a085-1d5723a85dfa",{"type":1146,"value":1147,"id":1150},"code_block",{"language":1148,"code":1149},"bash","kubectl get pods -n kube-system","1b0a3dac-6a6b-4ba0-ade3-b904110f5781",{"type":1107,"value":1152,"id":1155},{"box_type":1153,"content":1154},"info","\u003Cp data-block-key=\"o04c3\">به دنبال پادی با نام مشابه <etcd-node-name> بگردید.\u003C/p>","47914ae9-0a8d-4871-a6df-83edbef5f030",{"type":1113,"value":1157,"id":1160},{"heading_text":1158,"size":1139,"link_id":1159},"۲- استخراج سرتیفیکیتها","export-certificate","575a4c8a-e0f9-4955-bd87-36515ff68366",{"type":1103,"value":1162,"id":1163},"\u003Cp data-block-key=\"qmhfu\">سرتیفیکیتها را از پاد etcd کپی کنید.\u003C/p>","54a2e76c-fa07-4fb1-b4da-15293a0ee7b3",{"type":1146,"value":1165,"id":1167},{"language":1148,"code":1166},"kubectl cp kube-system/\u003Cetcd-pod-name>:/etc/kubernetes/pki/etcd/ca.crt ./ca.crt\r\nkubectl cp kube-system/\u003Cetcd-pod-name>:/etc/kubernetes/pki/etcd/healthcheck-client.crt ./client.crt\r\nkubectl cp kube-system/\u003Cetcd-pod-name>:/etc/kubernetes/pki/etcd/healthcheck-client.key ./client.key","35b8bf01-849a-4d97-abc5-5f5d85baca70",{"type":1113,"value":1169,"id":1172},{"heading_text":1170,"size":1139,"link_id":1171},"۳- ساخت یک Secret برای سرتیفیکیتها","create-secret","c8e7998c-8e3f-4e45-9c7d-6e8c25c5d8a8",{"type":1103,"value":1174,"id":1175},"\u003Cp data-block-key=\"r5efi\">سرتیفیکیتهای etcd را در یک secret ذخیره کنید.\u003C/p>","3eefe4cf-6321-4e45-a446-1ad32837cc66",{"type":1146,"value":1177,"id":1179},{"language":1148,"code":1178},"kubectl create secret generic etcd-certs \\\r\n --from-file=ca.crt=./ca.crt \\\r\n --from-file=client.crt=./client.crt \\\r\n --from-file=client.key=./client.key -n monitoring","ccf56867-09e1-429e-913b-23fefe0cee70",{"type":1113,"value":1181,"id":1184},{"heading_text":1182,"size":1133,"link_id":1183},"گام ۲: راهاندازی Prometheus","setup-prometheus","530074ba-b383-42d8-bc02-ddce78598e1a",{"type":1103,"value":1186,"id":1187},"\u003Cp data-block-key=\"ca20c\">اگر Prometheus را در کلاستر خود نصب نکردهاید، مراحل زیر را برای دیپلوی آن دنبال کنید. در غیر این صورت این گام را رد کنید:\u003C/p>","a96da7a7-db00-43d9-b1f2-4a75eadc01ef",{"type":1113,"value":1189,"id":1192},{"heading_text":1190,"size":1139,"link_id":1191},"۱- نصب kube-prometheus-stack","kube-prometheus-stack","b843588f-c3d8-4528-a0d6-181cc7965407",{"type":1146,"value":1194,"id":1196},{"language":1148,"code":1195},"helm repo add prometheus-community https://prometheus-community.github.io/helm-charts\r\nhelm repo update","68128e83-943d-46dd-bc99-6a03d53c6889",{"type":1103,"value":1198,"id":1199},"\u003Cp data-block-key=\"o3ucs\">Prometheus و Grafana را با استفاده از چارت Helm دیپلوی کنید.\u003C/p>","390327b6-8742-436a-b779-7d465f5c55a3",{"type":1146,"value":1201,"id":1203},{"language":1148,"code":1202},"helm install prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring --create-namespace","e4a0de8a-a2f5-43db-b487-7dbdd924fdb1",{"type":1113,"value":1205,"id":1208},{"heading_text":1206,"size":1139,"link_id":1207},"۲- دسترسی به Prometheus و Grafana:","access-prometheus-grafana","edbd5c69-317f-415c-b329-d3a171bec632",{"type":1103,"value":1210,"id":1211},"\u003Cp data-block-key=\"o3ucs\">پس از دیپلوی میتوانید از طریق port-forward و یا expose کردن سرویسها به رابطهای Prometheus و Grafana دسترسی پیدا کنید.\u003C/p>","01b54d45-49f7-43ee-a91c-0c10afaea29b",{"type":1146,"value":1213,"id":1215},{"language":1148,"code":1214},"kubectl port-forward -n monitoring svc/prometheus-stack-prometheus 9090:9090\r\nkubectl port-forward -n monitoring svc/prometheus-stack-grafana 3000:80","744f2395-a97b-4227-9e09-293bc670bcc2",{"type":1107,"value":1217,"id":1219},{"box_type":1153,"content":1218},"\u003Cp data-block-key=\"o04c3\">اطلاعات پیشفرض Grafana:\u003C/p>\u003Cul>\u003Cli data-block-key=\"3k4d9\">نام کاربری: admin\u003C/li>\u003C/ul>\u003Cp data-block-key=\"12sbd\">رمز عبور: با دستور زیر بازیابی کنید:\u003C/p>","2960993b-5c0d-40a2-b477-5b0b568286b5",{"type":1146,"value":1221,"id":1223},{"language":1148,"code":1222},"kubectl get secret -n monitoring prometheus-stack-grafana -o jsonpath=\"{.data.admin-password}\" | base64 --decode","2a2edb51-490c-4c1f-aafa-5d60c30ecf9a",{"type":1113,"value":1225,"id":1228},{"heading_text":1226,"size":1133,"link_id":1227},"گام ۳: تنظیم Prometheus برای جمعآوری متریکهای etcd","collection-metrics","6853eb0a-494c-4409-97ef-7ea147c245a4",{"type":1113,"value":1230,"id":1233},{"heading_text":1231,"size":1139,"link_id":1232},"۱- ساخت سرویس برای etcd","create-service","5b957496-bc6f-4938-a45f-254727e6f8cb",{"type":1146,"value":1235,"id":1237},{"language":20,"code":1236},"apiVersion: v1\r\nkind: Service\r\nmetadata:\r\n name: etcd-metrics\r\n namespace: kube-system\r\n labels:\r\n k8s-app: etcd\r\nspec:\r\n ports:\r\n - name: https-metrics\r\n port: 2379\r\n protocol: TCP\r\n targetPort: 2379\r\n selector:\r\n component: etcd","8b5c1d46-2dd4-424a-9335-5bdd0db0bc9b",{"type":1103,"value":1239,"id":1240},"\u003Cp data-block-key=\"ypjqf\">سپس آن را اعمال کنید.\u003C/p>","41da9853-cec9-4872-ae7b-f174f08ae96b",{"type":1146,"value":1242,"id":1244},{"language":1148,"code":1243},"kubectl apply -f etcd-service.yaml","d44da23d-9cf4-4d3e-8a12-13e06fa64317",{"type":1113,"value":1246,"id":1249},{"heading_text":1247,"size":1139,"link_id":1248},"۲- ساخت Service Monitor برای etcd","create-servicemonitor","e7ab4859-79db-4ee0-9e19-520c2beb9217",{"type":1146,"value":1251,"id":1253},{"language":20,"code":1252},"apiVersion: monitoring.coreos.com/v1\r\nkind: ServiceMonitor\r\nmetadata:\r\n name: etcd\r\n namespace: monitoring\r\n labels:\r\n release: prometheus-stack\r\nspec:\r\n selector:\r\n matchLabels:\r\n k8s-app: etcd\r\n endpoints:\r\n - port: https-metrics\r\n scheme: https\r\n tlsConfig:\r\n caFile: /etc/prometheus/secrets/etcd-certs/ca.crt\r\n certFile: /etc/prometheus/secrets/etcd-certs/client.crt\r\n keyFile: /etc/prometheus/secrets/etcd-certs/client.key\r\n interval: 30s\r\n namespaceSelector:\r\n matchNames:\r\n - kube-system","e967cb30-3cd5-4e72-bfef-0ebfa78725f4",{"type":1103,"value":1239,"id":1255},"ae6acc6a-57ea-41ab-bdde-9d363bac995d",{"type":1146,"value":1257,"id":1259},{"language":1148,"code":1258},"kubectl apply -f etcd-servicemonitor.yaml","b23ce7b1-29fe-4786-a769-7043f14bb39e",{"type":1113,"value":1261,"id":1264},{"heading_text":1262,"size":1139,"link_id":1263},"۳- بررسی راهاندازی","launch","8255a3b2-f5dd-45e1-8b78-2c21f7e6710e",{"type":1103,"value":1266,"id":1267},"\u003Cp data-block-key=\"ypjqf\">تارگت های Prometheus را بررسی کنید تا اطمینان حاصل کنید متریکهای etcd جمعآوری میشوند.\u003C/p>","ed12aeef-1844-4fc4-9c43-f2a9743a5f20",{"type":1146,"value":1269,"id":1271},{"language":1148,"code":1270},"kubectl port-forward -n monitoring svc/prometheus-stack-prometheus 9090:9090","473ec740-8148-40a8-b859-dbab027cee2a",{"type":1107,"value":1273,"id":1275},{"box_type":1109,"content":1274},"\u003Cp data-block-key=\"o04c3\">به http://localhost:9090/targets بروید و اطمینان حاصل کنید که تارگت های etcd بهصورت UP ظاهر میشود.\u003C/p>","936e403b-9dac-46d4-bdd8-4770fe60a42b",{"type":1113,"value":1277,"id":1280},{"heading_text":1278,"size":1133,"link_id":1279},"گام ۴: استفاده از Grafana","use-grafana","0a861799-f792-4942-b5e2-c5ed745f3aa2",{"type":1113,"value":1282,"id":1285},{"heading_text":1283,"size":1139,"link_id":1284},"۱- وارد کردن داشبورد etcd","etcd-dashboard","0a1eacff-5221-4b93-8cd9-b9f6e7e98f2f",{"type":1103,"value":1287,"id":1288},"\u003Cp data-block-key=\"f6rtu\">یک داشبورد آماده etcd را از جامعه Grafana وارد کنید. به \u003Cb>Dashboards > Import\u003C/b> بروید و ID داشبورد را وارد کنید یا فایل JSON را آپلود کنید. به طور مثال \u003Cb>می توانید از\u003C/b>\u003Ca href=\"https://grafana.com/grafana/dashboards/15308-etcd-cluster-overview/\">\u003Cb>این دشبورد آماده\u003C/b>\u003C/a>\u003Cb> استفاده نمایید\u003C/b>.\u003C/p>","6b8961c2-477b-428d-9430-caaad180b5d0",{"type":1290,"value":1291,"id":1299},"image_block",{"title":1292,"file":1293,"sources":1294,"width":1296,"height":1297,"file_size":1298},"grafana","https://s3.thr1.sotoon.ir/ravi-statics/media/original_images/unnamed_ahuTfSf.png",{"png":1293,"jpg":1295},"https://s3.thr1.sotoon.ir/ravi-statics/media/images/unnamed_ahuTfSf.format-jpeg.jpg",1432,1600,1231207,"866eaa0f-83db-4eb3-808a-30a6b53c7d9c",{"type":1113,"value":1301,"id":1304},{"heading_text":1302,"size":1139,"link_id":1303},"۲- ساخت هشدارها (Alerts)","create-alert","e9d6cc80-090d-453a-80a3-3ec2da9edf51",{"type":1103,"value":1306,"id":1307},"\u003Cp data-block-key=\"f6rtu\">همچنین میتوانید الرتهایی برای etcd ست کنید.\u003C/p>\u003Cul>\u003Cli data-block-key=\"aivv9\">الرت برای سایز دیتابیس:\u003C/li>\u003C/ul>","8d1ad135-0cb3-4aaa-a972-d5263f53e45e",{"type":1146,"value":1309,"id":1312},{"language":1310,"code":1311},"css","(etcd_server_quota_backend_bytes - etcd_debugging_mvcc_db_total_size_in_bytes) \u003C 100 * 1024 * 1024","d2d395c5-5e9f-4dc3-ae9d-3ac236dcb352",{"type":1103,"value":1314,"id":1315},"\u003Cul>\u003Cli data-block-key=\"f6rtu\">وضعیت لیدر: etcd_server_has_leader == 0\u003C/li>\u003Cli data-block-key=\"a0ks\">تأخیر دیسک: etcd_disk_backend_commit_duration_seconds\u003C/li>\u003Cli data-block-key=\"a603o\">پیشنهادات ناموفق: etcd_server_proposals_failed_total\u003C/li>\u003C/ul>","bc37ec95-5ddf-448a-b93f-1f9fd70f31ac",[1317,1318],{"heading_text":1115,"size":1116,"link_id":1117},{"heading_text":1124,"size":1116,"link_id":1125},{"slug":903,"title":904},["Reactive",1321],{"$snuxt-i18n-meta":1322,"$sroute-nav-config":1323,"$ssite-config":1327},{},["ShallowRef",1324],{"variant":1325,"position":1326,"container":97},"light","static",{"currentLocale":1328,"description":1329,"env":1330,"name":1331,"url":1332},"fa","Managing Sotoon products showcase","production","sotoon","https://sotoon.ir",["Set"],["ShallowReactive",1335],{"products":-1,"documents:products":-1,"$APL8jXlmTi":-1},"/docs/kubernetes/kubernetes/challenges-and-solutions/etcd-management"]