{"id":57621,"date":"2025-08-15T16:21:00","date_gmt":"2025-08-15T08:21:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/57621.html"},"modified":"2025-08-15T16:21:00","modified_gmt":"2025-08-15T08:21:00","slug":"k8sday06%e6%b7%b1%e5%85%a5%e6%8e%a7%e5%88%b6%e5%99%a8%ef%bc%882-3%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/57621.html","title":{"rendered":"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"StatefulSet%EF%BC%88sts%EF%BC%89-toc\" style=\"margin-left:40px\">StatefulSet&#xff08;sts&#xff09;<\/p>\n<p id=\"%E4%B8%80%E3%80%81%E5%9F%BA%E7%A1%80%E6%A6%82%E5%BF%B5-toc\" style=\"margin-left:80px\">\u4e00\u3001\u57fa\u7840\u6982\u5ff5<\/p>\n<p id=\"%E4%BA%8C%E3%80%81%E5%92%8C%E6%97%A0%E7%8A%B6%E6%80%81%E5%BA%94%E7%94%A8%E6%8E%A7%E5%88%B6%E5%99%A8%E7%9A%84%E5%8C%BA%E5%88%AB-toc\" style=\"margin-left:80px\">\u4e8c\u3001\u548c\u65e0\u72b6\u6001\u5e94\u7528\u63a7\u5236\u5668\u7684\u533a\u522b<\/p>\n<p id=\"%E4%B8%89%E3%80%81%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6-toc\" style=\"margin-left:80px\">\u4e09\u3001\u914d\u7f6e\u6587\u4ef6<\/p>\n<p id=\"1%E3%80%81%E4%B8%BE%E4%BE%8B-toc\" style=\"margin-left:120px\">1\u3001\u4e3e\u4f8b<\/p>\n<p id=\"2%E3%80%81%E5%8F%AF%E8%83%BD%E9%97%AE%E9%A2%98-toc\" style=\"margin-left:120px\">2\u3001\u53ef\u80fd\u95ee\u9898<\/p>\n<p id=\"3%E3%80%81%E9%AA%8C%E8%AF%81%E6%88%90%E5%8A%9F-toc\" style=\"margin-left:120px\">3\u3001\u9a8c\u8bc1\u6210\u529f<\/p>\n<p id=\"%E5%9B%9B%E3%80%81%E5%A4%B1%E8%B4%A5%E5%90%8E%E5%81%9A%E6%B3%95-toc\" style=\"margin-left:80px\">\u56db\u3001\u5931\u8d25\u540e\u505a\u6cd5<\/p>\n<p id=\"1%E3%80%81%E5%88%A0%E9%99%A4%E6%97%A7StatefulSet-toc\" style=\"margin-left:120px\">1\u3001\u5220\u9664\u65e7StatefulSet<\/p>\n<p id=\"2%E3%80%81%E5%88%A0%E9%99%A4%E6%97%A7PVC%E3%80%90%E5%8F%AF%E9%80%89%EF%BC%8C%E4%BC%9A%E5%AF%BC%E8%87%B4%E5%8E%9F%E6%9D%A5%E6%95%B0%E6%8D%AE%E4%B8%A2%E5%A4%B1%E3%80%91-toc\" style=\"margin-left:120px\">2\u3001\u5220\u9664\u65e7PVC\u3010\u53ef\u9009&#xff0c;\u4f1a\u5bfc\u81f4\u539f\u6765\u6570\u636e\u4e22\u5931\u3011<\/p>\n<p id=\"3%E3%80%81%E9%AA%8C%E8%AF%81%E5%88%A0%E9%99%A4-toc\" style=\"margin-left:120px\">3\u3001\u9a8c\u8bc1\u5220\u9664<\/p>\n<p id=\"%E4%BA%94%E3%80%81%E6%89%A9%E5%AE%B9%E7%BC%A9%E5%AE%B9-toc\" style=\"margin-left:80px\">\u4e94\u3001\u6269\u5bb9\u7f29\u5bb9<\/p>\n<p id=\"1%E3%80%81Scale%E5%91%BD%E4%BB%A4-toc\" style=\"margin-left:120px\">1\u3001Scale\u547d\u4ee4<\/p>\n<p id=\"2%E3%80%81edit%2Fpatch%2F%E5%A4%96%E9%83%A8%E7%BC%96%E8%BE%91%E5%99%A8-toc\" style=\"margin-left:120px\">2\u3001edit\/patch\/\u5916\u90e8\u7f16\u8f91\u5668<\/p>\n<p id=\"%E5%85%AD%E3%80%81%E6%9B%B4%E6%96%B0%E7%AD%96%E7%95%A5-toc\" style=\"margin-left:80px\">\u516d\u3001\u66f4\u65b0\u7b56\u7565<\/p>\n<p id=\"1%E3%80%81RollingUpdate(%E6%BB%9A%E5%8A%A8%E6%9B%B4%E6%96%B0)-toc\" style=\"margin-left:120px\">1\u3001RollingUpdate(\u6eda\u52a8\u66f4\u65b0)<\/p>\n<p id=\"%E2%91%A0%E3%80%81%E7%AE%80%E5%8D%95%E6%BB%9A%E5%8A%A8%E6%9B%B4%E6%96%B0-toc\" style=\"margin-left:160px\">\u2460\u3001\u7b80\u5355\u6eda\u52a8\u66f4\u65b0<\/p>\n<p id=\"%E2%91%A1%E3%80%81%E9%87%91%E4%B8%9D%E9%9B%80%E5%8F%91%E5%B8%83-toc\" style=\"margin-left:160px\">\u2461\u3001\u91d1\u4e1d\u96c0\u53d1\u5e03<\/p>\n<p id=\"2%E3%80%81OnDelete%EF%BC%88%E5%88%A0%E9%99%A4%E6%9B%B4%E6%96%B0%EF%BC%89-toc\" style=\"margin-left:120px\">2\u3001OnDelete&#xff08;\u5220\u9664\u66f4\u65b0&#xff09;<\/p>\n<p id=\"%E2%80%8B%E7%BC%96%E8%BE%91-toc\" style=\"margin-left:80px\">\u200b\u7f16\u8f91<\/p>\n<p id=\"%E4%B8%83%E3%80%81%E5%88%A0%E9%99%A4-toc\" style=\"margin-left:80px\">\u4e03\u3001\u5220\u9664<\/p>\n<hr id=\"hr-toc\" \/>\n<p>\u5728k8sday06\u7684\u5b66\u4e60\u4e2d\u6211\u4eec\u5df2\u7ecf\u5b66\u4e60\u4e86\u65e0\u72b6\u6001\u5e94\u7528\u5e38\u7528\u7684\u63a7\u5236\u5668\u2014\u2014Deployment<\/p>\n<p>\u5728\u4eca\u5929\u7684\u5b66\u4e60\u4e2d\u6211\u5c06\u4f1a\u7ee7\u7eed\u5b66\u4e60\u6709\u72b6\u6001\u5e94\u7528\u7684\u63a7\u5236\u5668\u2014\u2014StatefulSet<\/p>\n<h3 id=\"StatefulSet%EF%BC%88sts%EF%BC%89\">StatefulSet&#xff08;sts&#xff09;<\/h3>\n<h4 id=\"%E4%B8%80%E3%80%81%E5%9F%BA%E7%A1%80%E6%A6%82%E5%BF%B5\">\u4e00\u3001\u57fa\u7840\u6982\u5ff5<\/h4>\n<p>StatefulSet \u662f Kubernetes \u4e2d\u7528\u4e8e\u7ba1\u7406\u6709\u72b6\u6001\u5e94\u7528\u7684\u63a7\u5236\u5668&#xff0c;\u5b83\u63d0\u4f9b\u4e86\u6709\u5e8f\u7684\u90e8\u7f72\u3001\u6269\u5c55\u548c\u66f4\u65b0\u673a\u5236&#xff0c;\u9002\u7528\u4e8e\u9700\u8981\u6301\u4e45\u5316\u5b58\u50a8\u548c\u7a33\u5b9a\u7f51\u7edc\u6807\u8bc6\u7684\u573a\u666f\u3002\u5b83\u4e3a\u6bcf\u4e2a Pod \u63d0\u4f9b\u7a33\u5b9a\u7684\u7f51\u7edc\u8eab\u4efd\u548c\u6301\u4e45\u5316\u5b58\u50a8\u3002<\/p>\n<ul>\n<li>\n<p>\u53ef\u5bf9\u6709\u72b6\u6001\u670d\u52a1\u5668\u7684DNS\u8fdb\u884c\u7ba1\u7406&#xff0c;\u5b9e\u73b0\u7a33\u5b9a\u7684\u7f51\u7edc\u6807\u5fd7 Headless Service<\/p>\n<\/li>\n<li>\n<p>\u53ef\u4ee5\u5bf9\u6570\u636e\u8fdb\u884c\u7ba1\u7406&#xff0c;\u5b9e\u73b0\u6301\u4e45\u5316\u5b58\u50a8&#xff0c;\u907f\u514d\u6570\u636e\u4e22\u5931 VolumeClaim Template<\/p>\n<\/li>\n<li>\n<p>\u540c\u65f6\u5b9e\u73b0\u6709\u5e8f\u7684\u6062\u590d\u5220\u9664&#xff0c;\u4f38\u7f29\u6269\u5bb9<\/p>\n<\/li>\n<\/ul>\n<h4 id=\"%E4%BA%8C%E3%80%81%E5%92%8C%E6%97%A0%E7%8A%B6%E6%80%81%E5%BA%94%E7%94%A8%E6%8E%A7%E5%88%B6%E5%99%A8%E7%9A%84%E5%8C%BA%E5%88%AB\">\u4e8c\u3001\u548c\u65e0\u72b6\u6001\u5e94\u7528\u63a7\u5236\u5668\u7684\u533a\u522b<\/h4>\n<p>\u65e0\u72b6\u6001\u5e94\u7528\u4e0d\u4f1a\u5bf9\u672c\u5730\u4ea7\u751f\u4f9d\u8d56&#xff0c;\u8fd9\u6837Deployment\u53ef\u4ee5\u60f3\u5220\u9664\u5c31\u5220\u9664&#xff0c;\u60f3\u6269\u5bb9\u7f29\u5bb9\u5c31\u6269\u5bb9\u7f29\u5bb9&#xff0c;\u800c\u6709\u72b6\u6001\u5e94\u7528\u5bf9\u672c\u5730\u4ea7\u751f\u4f9d\u8d56&#xff0c;\u4f9d\u8d56\u4e8e\u4e0a\u9762\u7684\u7f51\u7edc\u554a&#xff0c;\u6587\u4ef6\u554a\u7b49\u7b49&#xff0c;\u5bfc\u81f4\u4e8c\u8005\u4e0d\u540c<\/p>\n<table>\n<tr>\u7279\u6027StatefulSetDeployment<\/tr>\n<tbody>\n<tr>\n<td>\u90e8\u7f72\u987a\u5e8f<\/td>\n<td>\u6709\u5e8f&#xff08;pod-0 \u542f\u52a8\u540e\u624d\u542f\u52a8 pod-1&#xff09;<\/td>\n<td>\u65e0\u5e8f&#xff08;Pod \u542f\u52a8\u987a\u5e8f\u4e0d\u56fa\u5b9a&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u7ec8\u6b62\u987a\u5e8f<\/td>\n<td>\u6709\u5e8f&#xff08;pod-2 \u7ec8\u6b62\u540e\u624d\u7ec8\u6b62 pod-1&#xff09;<\/td>\n<td>\u65e0\u5e8f&#xff08;Pod \u7ec8\u6b62\u987a\u5e8f\u4e0d\u56fa\u5b9a&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u7f51\u7edc\u6807\u8bc6<\/td>\n<td>\u7a33\u5b9a&#xff08;\u5982 statefulset-name-0&#xff09;<\/td>\n<td>\u52a8\u6001&#xff08;Pod \u7684 IP \u5730\u5740\u52a8\u6001\u5206\u914d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u6301\u4e45\u5316\u5b58\u50a8<\/td>\n<td>\u652f\u6301&#xff08;\u6bcf\u4e2a Pod \u6709\u81ea\u5df1\u7684\u6570\u636e\u5377 PVC&#xff09;<\/td>\n<td>\u4e0d\u652f\u6301&#xff08;Pod \u7684\u6570\u636e\u5b58\u50a8\u5728\u4e34\u65f6\u5b58\u50a8\u4e2d&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u66f4\u65b0\u7b56\u7565<\/td>\n<td>\u652f\u6301\u6eda\u52a8\u66f4\u65b0\u548c\u5206\u533a\u66f4\u65b0<\/td>\n<td>\u652f\u6301\u6eda\u52a8\u66f4\u65b0<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u6570\u636e\u5e93\u3001\u6d88\u606f\u961f\u5217\u3001\u5206\u5e03\u5f0f\u5b58\u50a8<\/td>\n<td>Web \u670d\u52a1\u5668\u3001\u5fae\u670d\u52a1\u3001\u65e0\u72b6\u6001\u5e94\u7528<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"%E4%B8%89%E3%80%81%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6\">\u4e09\u3001\u914d\u7f6e\u6587\u4ef6<\/h4>\n<h5 id=\"1%E3%80%81%E4%B8%BE%E4%BE%8B\">1\u3001\u4e3e\u4f8b<\/h5>\n<p>\u4ee5\u4e0b\u7ed9\u51fa\u4e00\u4efd<span style=\"background-color:#fefcd8\">\u57fa\u7840\u7684StatefulSet\u914d\u7f6e\u57fa\u672c\u7684MySQL\u90e8\u7f72\u7684yaml\u521b\u5efa\u6587\u4ef6<\/span>&#xff0c;\u5e76\u7ed9\u51fa\u6bcf\u4e00\u6b65\u7684\u89e3\u91ca&#xff1a;<\/p>\n<p>\u6ce8\u610f\u53ea\u7ed9\u51fa\u57fa\u672c\u7684\u914d\u7f6e&#xff0c;\u5176\u4ed6\u914d\u7f6e\u5982\u63a2\u9488\u63a2\u6d4b\u554a&#xff0c;\u5bc6\u6587\u5bc6\u7801\u554a&#xff0c;\u91cd\u542f\u7b56\u7565\u7b49\u7b49&#xff0c;\u5982\u6709\u9700\u8981&#xff0c;\u81ea\u884c\u914d\u7f6e~<\/p>\n<p>  apiVersion: apps\/v1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # StatefulSet \u7684API\u7248\u672c<br \/>\n  kind: StatefulSet \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # \u58f0\u660e\u8d44\u6e90\u7c7b\u578b\u662f StatefulSet<br \/>\n  metadata: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # StatefulSet \u7684\u5143\u4fe1\u606f<br \/>\n    name: mysql-statefulset1 \u00a0 \u00a0 \u00a0# \u521b\u5efa\u7684 StatefulSet \u7684\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;&#xff0c;\u6ce8\u610f\u5168\u5c0f\u5199<br \/>\n  \u200b<br \/>\n  spec: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # StatefulSet \u7684\u89c4\u7ea6&#xff08;\u671f\u671b\u72b6\u6001&#xff09;<br \/>\n    serviceName: &#034;mysql&#034;<br \/>\n   \u00a0#\u6307\u5b9a\u4e00\u4e2a Headless Service \u7684\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;&#xff0c;\u7528\u4e8e\u4e3a\u6bcf\u4e2a Pod \u63d0\u4f9b\u7a33\u5b9a\u7684\u7f51\u7edc\u6807\u8bc6<br \/>\n    replicas: 3 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u6307\u5b9a StatefulSet \u4e2d Pod \u7684\u526f\u672c\u6570<br \/>\n    selector: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u7528\u4e8e\u9009\u62e9 StatefulSet \u7ba1\u7406\u7684 Pod<br \/>\n   \u00a0  matchLabels: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u5339\u914d\u6807\u7b7e<br \/>\n   \u00a0 \u00a0  app: mysql \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u8981\u6c42 Pod \u7684\u6807\u7b7e\u4e2d\u5305\u542b app: mysql&#xff08;\u8be5\u952e\u503c\u5bf9\u53ef\u81ea\u5b9a\u4e49&#xff09;<br \/>\n    template: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u5b9a\u4e49 Pod \u7684\u6a21\u677f<br \/>\n   \u00a0  metadata: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # Pod \u7684\u5143\u4fe1\u606f<br \/>\n   \u00a0 \u00a0  labels: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u4e3a Pod \u8bbe\u7f6e\u6807\u7b7e\u4e3a app: mysql<br \/>\n   \u00a0 \u00a0 \u00a0  app: mysql<br \/>\n   \u00a0  spec: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 # Pod\u7684\u89c4\u7ea6&#xff08;\u671f\u671b\u72b6\u6001&#xff09;<br \/>\n   \u00a0 \u00a0  containers:<br \/>\n   \u00a0 \u00a0  &#8211; name: mysql \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u5bb9\u5668\u7684\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;<br \/>\n   \u00a0 \u00a0 \u00a0  image: mysql:latest \u00a0 \u00a0 #\u5bb9\u5668\u4f7f\u7528\u7684\u955c\u50cf&#xff0c;\u4e0d\u5199\u7248\u672c\u9ed8\u8ba4\u6700\u65b0\u7248,\u4e0d\u63a8\u8350\u4f7f\u7528latest<br \/>\n   \u00a0 \u00a0 \u00a0  imagePullPolicy: IfNotPresent #\u62c9\u53d6\u7b56\u7565&#xff0c;\u672c\u5730\u6709\u62c9\u672c\u5730\u7684&#xff0c;\u6ca1\u6709\u62c9\u8fdc\u5904<br \/>\n   \u00a0 \u00a0 \u00a0  env: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u5b9a\u4e49\u73af\u5883\u53d8\u91cf<br \/>\n   \u00a0 \u00a0 \u00a0  &#8211; name: MYSQL_ROOT_PASSWORD #\u73af\u5883\u53d8\u91cf\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u8bbe\u7f6e MySQL \u7684 root \u5bc6\u7801\u4e3a \u201c123456\u201d<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0  value: &#034;123456&#034;<br \/>\n   \u00a0 \u00a0 \u00a0  ports: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u5b9a\u4e49\u5bb9\u5668\u66b4\u9732\u7684\u7aef\u53e3<br \/>\n   \u00a0 \u00a0 \u00a0  &#8211; containerPort: 3306 \u00a0 #\u5bb9\u5668\u5185\u90e8\u7aef\u53e33306<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0  name: mysql \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u7aef\u53e3\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;<br \/>\n   \u00a0 \u00a0 \u00a0  volumeMounts: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u5b9a\u4e49\u6302\u8f7d\u7684\u5377<br \/>\n   \u00a0 \u00a0 \u00a0  &#8211; name: mysql-data \u00a0 \u00a0 \u00a0#\u5377\u7684\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0  mountPath: \/var\/lib\/mysql #\u5377\u5728\u5bb9\u5668\u5185\u7684\u6302\u8f7d\u8def\u5f84<br \/>\n    updateStrategy: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u66f4\u65b0\u7b56\u7565&#xff0c;\u548c Pod \u6a21\u677f\u540c\u7ea7<br \/>\n   \u00a0  type: RollingUpdate \u00a0 \u00a0 \u00a0 \u00a0 #\u66f4\u65b0\u7b56\u7565\u7c7b\u578b&#xff0c;\u8fd9\u91cc\u662f\u6eda\u52a8\u66f4\u65b0<br \/>\n   \u00a0  rollingUpdate:<br \/>\n   \u00a0 \u00a0  partition: 0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u6eda\u52a8\u66f4\u65b0\u7684\u5206\u533a&#xff0c;\u8fd9\u91cc\u662f\u4ece0\u5f00\u59cb\u66f4\u65b0<br \/>\n    volumeClaimTemplates: \u00a0 \u00a0 \u00a0 \u00a0 #\u5b9a\u4e49\u6bcf\u4e2a Pod \u7684\u6301\u4e45\u5316\u5b58\u50a8\u5377\u6a21\u677f<br \/>\n    &#8211; metadata: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u6570\u636e\u5377\u6a21\u677f\u7684\u5143\u4fe1\u606f<br \/>\n   \u00a0 \u00a0  name: mysql-data \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u6a21\u677f\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;<br \/>\n   \u00a0  spec: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u6570\u636e\u5377\u6a21\u677f\u7684\u89c4\u7ea6&#xff08;\u671f\u671b\u72b6\u6001&#xff09;<br \/>\n   \u00a0 \u00a0 \u00a0#\u5b9a\u4e49\u5377\u7684\u8bbf\u95ee\u6a21\u5f0f&#xff0c;\u8fd9\u91cc\u662f ReadWriteOnce&#xff0c;\u8868\u793a\u5377\u53ea\u80fd\u88ab\u4e00\u4e2a\u8282\u70b9\u4ee5\u8bfb\u5199\u6a21\u5f0f\u6302\u8f7d<br \/>\n   \u00a0 \u00a0  accessModes: [&#034;ReadWriteOnce&#034;]<br \/>\n   \u00a0 \u00a0  resources: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u8d44\u6e90\u914d\u7f6e\u8bf7\u6c42\u4e0e\u9650\u5236<br \/>\n   \u00a0 \u00a0 \u00a0  requests: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u6700\u5c11\u9700\u8981\u7684\u8d44\u6e90<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0  storage: 1Gi \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u5b9a\u4e49\u8bf7\u6c42\u7684\u5b58\u50a8\u5927\u5c0f\u4e3a1GB <\/p>\n<p>\u5982\u679c\u955c\u50cf\u6807\u7b7e\u662f :latest \u6216\u672a\u6307\u5b9a\u6807\u7b7e&#xff0c;Kubernetes \u4f1a\u5f3a\u5236\u8bbe\u7f6e imagePullPolicy: Always&#xff0c;\u5373\u4f7f\u4f60\u663e\u5f0f\u6307\u5b9a\u4e86 IfNotPresent&#xff0c;\u5bfc\u81f4\u6211\u7684\u62c9\u53d6\u7b56\u7565\u5373\u4f7f\u8bbe\u7f6e\u4e86ifnotpresent\u4ecd\u4f1a\u53bbdocker hub\u62c9\u53d6&#xff0c;\u800c\u4e0d\u7528\u672c\u5730\u5df2\u7ecf\u62c9\u53d6\u597d\u7684\u3002<\/p>\n<p>\u4e0d\u63a8\u8350\u4f7f\u7528latest&#xff0c;\u53ef\u80fd\u4f1a\u5e26\u6765\u610f\u60f3\u4e0d\u5230\u7684\u67d0\u4e9b\u95ee\u9898&#xff0c; \u6b63\u786e\u505a\u6cd5\u662f\u4f7f\u7528\u660e\u786e\u7248\u672c\u53f7&#xff08;\u5982 nginx:1.25.3&#xff09;\u6216\u54c8\u5e0c\u503c&#xff08;\u5982 nginx&#064;sha256:abcd1234&#xff09;<\/p>\n<h5 id=\"2%E3%80%81%E5%8F%AF%E8%83%BD%E9%97%AE%E9%A2%98\">2\u3001\u53ef\u80fd\u95ee\u9898<\/h5>\n<p>\u5f53\u7136\u5728\u521b\u5efa\u7684\u65f6\u5019\u53ef\u80fd\u4f1a\u9047\u5230\u5728k8sday05\u63d0\u5230\u7684\u6b7b\u6d3b\u5c31\u662f\u62c9\u53d6\u4e0d\u4e86\u955c\u50cf&#xff0c;\u4f46\u662f\u5df2\u7ecf\u901a\u8fc7docker pull\u62c9\u53d6\u955c\u50cf\u6210\u529f\u4e86&#xff0c;\u8fd9\u65f6\u5019\u53ef\u4ee5\u6a21\u4eff\u4e0a\u6b21\u7684\u89e3\u51b3\u65b9\u6cd5\u6765\u89e3\u51b3<\/p>\n<p>\u6839\u672c\u539f\u56e0&#xff1a; Kind \u9ed8\u8ba4\u4f7f\u7528 containerd \u4f5c\u4e3a\u5bb9\u5668\u8fd0\u884c\u65f6&#xff0c;\u800c docker images \u4e2d\u7684\u955c\u50cf \u4e0d\u4f1a\u81ea\u52a8\u540c\u6b65\u5230 containerd**&#xff0c;\u5bfc\u81f4 Kubernetes \u65e0\u6cd5\u627e\u5230\u955c\u50cf\u3002<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;\u5c06\u672c\u5730 Docker \u955c\u50cf\u52a0\u8f7d\u5230 Kind \u96c6\u7fa4&#xff0c;\u7ed5\u8fc7 Docker Hub \u62c9\u53d6&#xff0c;KinD \u7684\u8282\u70b9\u672c\u8d28\u662f Docker \u5bb9\u5668&#xff0c;kind load \u4f1a\u5c06\u672c\u5730\u955c\u50cf\u5bfc\u5165\u5230\u8fd9\u4e9b\u8282\u70b9\u4e2d&#xff0c;\u4f7f Pod \u53ef\u76f4\u63a5\u4f7f\u7528\u3002<\/p>\n<p>kind load docker-image mysql:latest &#8211;name &lt;\u4f60\u8981\u62c9\u53d6\u5230\u7684\u96c6\u7fa4\u540d\u79f0&gt; <\/p>\n<p>\u6210\u529f\u540e\u53ef\u5f97\u5230\u7c7b\u4f3c\u4fe1\u606f&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"143\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082009-689eedb946809.png\" width=\"1600\" \/><\/p>\n<p>\u4e4b\u540e\u901a\u8fc7\u5e94\u7528yaml\u6587\u4ef6\u521b\u5efaStatefulSet\u5373\u53ef&#xff1a;<\/p>\n<p>kubectl apply -f &lt;\u4f60\u81ea\u5df1\u7684statefulset\u7684\u914d\u7f6e\u6587\u4ef6\u540d\u79f0&gt; <\/p>\n<h5 id=\"3%E3%80%81%E9%AA%8C%E8%AF%81%E6%88%90%E5%8A%9F\">3\u3001\u9a8c\u8bc1\u6210\u529f<\/h5>\n<p>\u9a8c\u8bc1\u4f7f\u7528\u5982\u4e0b\u65b9\u6cd5&#xff1a;<\/p>\n<p>  # \u67e5\u770b\u5df2\u521b\u5efa\u7684 statefulset<br \/>\n  kubectl get statefulset<br \/>\n  \u200b<br \/>\n  # \u67e5\u770b\u5df2\u6709\u7684 Pod &#xff0c;\u5982\u679c\u521b\u5efa\u6210\u529f\u4f1a\u591a\u51fa3\u4e2a<br \/>\n  kubectl get po<br \/>\n  \u200b<br \/>\n  # \u67e5\u770b PVC<br \/>\n  kubectl get pvc <\/p>\n<p>\u6700\u7ec8\u53ef\u5f97\u5230\u7c7b\u4f3c\u4fe1\u606f\u5373\u521b\u5efa\u6210\u529f&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"441\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082012-689eedbce168b.png\" width=\"1600\" \/><\/p>\n<h4 id=\"%E5%9B%9B%E3%80%81%E5%A4%B1%E8%B4%A5%E5%90%8E%E5%81%9A%E6%B3%95\">\u56db\u3001\u5931\u8d25\u540e\u505a\u6cd5<\/h4>\n<p>\u4e0d\u8bba\u662f\u62c9\u53d6\u955c\u50cf\u5931\u8d25&#xff0c;\u8fd8\u662f\u521b\u5efaStatefulSet\u5931\u8d25\u7b49\u7b49&#xff0c;\u53ea\u8981\u662f\u6700\u7ec8\u6ca1\u6709\u6210\u529f\u521b\u5efa\u5b8c\u6210&#xff0c;\u90fd\u53ef\u4ee5\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\u91cd\u65b0\u6765\u8fc7&#xff1a;<\/p>\n<h5 id=\"1%E3%80%81%E5%88%A0%E9%99%A4%E6%97%A7StatefulSet\">1\u3001\u5220\u9664\u65e7StatefulSet<\/h5>\n<p> kubectl delete statefulset &lt;\u4f60\u521b\u5efa\u7684statefulset\u7684\u540d\u79f0&gt; <\/p>\n<h5 id=\"2%E3%80%81%E5%88%A0%E9%99%A4%E6%97%A7PVC%E3%80%90%E5%8F%AF%E9%80%89%EF%BC%8C%E4%BC%9A%E5%AF%BC%E8%87%B4%E5%8E%9F%E6%9D%A5%E6%95%B0%E6%8D%AE%E4%B8%A2%E5%A4%B1%E3%80%91\">2\u3001\u5220\u9664\u65e7PVC\u3010\u53ef\u9009&#xff0c;\u4f1a\u5bfc\u81f4\u539f\u6765\u6570\u636e\u4e22\u5931\u3011<\/h5>\n<p>  # \u6ce8\u610f\u4e0b\u884c\u4ee3\u7801\u7684 -l app&#061;mysql \u662f\u5728yaml\u6587\u4ef6\u4e2d\u914d\u7f6e\u7528\u6765\u5339\u914d\u6807\u7b7e\u7684<br \/>\n  # \u6240\u4ee5\u8bf4&#xff0c;\u5982\u679c\u4f60\u81ea\u5df1\u4fee\u6539\u4e86&#xff0c;\u8bb0\u5f97\u5e94\u8be5\u5199\u4f60\u81ea\u5df1\u8bbe\u7f6e\u7684\u6807\u7b7e<br \/>\n  kubectl delete pvc -l app&#061;mysql <\/p>\n<p>\u9ed8\u8ba4\u60c5\u51b5\u4e0b&#xff0c;\u5220\u9664 StatefulSet \u4e0d\u4f1a\u81ea\u52a8\u5220\u9664\u5176\u76f8\u5173\u7684 PVC&#xff0c;\u5982\u679c\u4f60\u60f3\u5220\u9664\u53ef\u4ee5\u8fdb\u884c\u64cd\u4f5c<\/p>\n<p><span style=\"color:#fe2c24\">\u786e\u4fdd\u4f60\u7684 PVC \u6807\u7b7e\u4e0e StatefulSet \u7684\u6807\u7b7e\u4e00\u81f4&#xff01;&#xff01;&#xff01;&#xff01;<\/span><\/p>\n<h5 id=\"3%E3%80%81%E9%AA%8C%E8%AF%81%E5%88%A0%E9%99%A4\">3\u3001\u9a8c\u8bc1\u5220\u9664<\/h5>\n<p>  kubectl get statefulset<br \/>\n  kubectl get pvc<br \/>\n  # \u5f53\u7136\u4e5f\u53ef\u4ee5\u52a0\u4e00\u4e2akubectl get po\u6765\u67e5\u770b\u526f\u672cpod\u662f\u5426\u521b\u5efa <\/p>\n<p>\u6700\u7ec8\u53ef\u4ee5\u770b\u5230\u7c7b\u4f3c\u6548\u679c&#xff1a;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"375\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082019-689eedc3b5d5f.png\" width=\"1581\" \/><\/p>\n<h4 id=\"%E4%BA%94%E3%80%81%E6%89%A9%E5%AE%B9%E7%BC%A9%E5%AE%B9\">\u4e94\u3001\u6269\u5bb9\u7f29\u5bb9<\/h4>\n<p>StatefulSet\u7684\u6269\u5bb9\u548c\u7f29\u5bb9\u548cDeployment\u51e0\u4e4e\u5b8c\u5168\u76f8\u540c&#xff0c;\u6839\u672c\u90fd\u662f\u5bf9replicas\u8fdb\u884c\u4fee\u6539&#xff0c;\u64cd\u4f5c\u65b9\u5f0f\u4e5f\u76f8\u540c&#xff1a;<\/p>\n<h5 id=\"1%E3%80%81Scale%E5%91%BD%E4%BB%A4\">1\u3001Scale\u547d\u4ee4<\/h5>\n<p>  # \u6269\u5bb9<br \/>\n  kubectl scale statefulset &lt;\u4f60\u7684statefulset\u540d\u79f0&gt; &#8211;replicas&#061;&lt;\u4f60\u671f\u5f85\u7684\u6269\u5bb9\u7684\u6570\u91cf&gt;<br \/>\n  \u200b<br \/>\n  # \u7f29\u5bb9<br \/>\n  kubectl scale statefulset &lt;\u4f60\u7684statefulset\u540d\u79f0&gt; &#8211;replicas&#061;&lt;\u4f60\u671f\u5f85\u7684\u7f29\u5bb9\u7684\u6570\u91cf&gt; <\/p>\n<h5 id=\"2%E3%80%81edit%2Fpatch%2F%E5%A4%96%E9%83%A8%E7%BC%96%E8%BE%91%E5%99%A8\">2\u3001edit\/patch\/\u5916\u90e8\u7f16\u8f91\u5668<\/h5>\n<p>\u901a\u8fc7\u76f4\u63a5\u5bf9yaml\u6587\u4ef6\u8fdb\u884c\u4fee\u6539\u8fbe\u5230\u6269\u5bb9\u548c\u7f29\u5bb9\u7684\u6548\u679c<\/p>\n<p>  # \u6269\u5bb9<br \/>\n  spec:<br \/>\n    replicas:&lt;\u4f60\u671f\u5f85\u7684\u6269\u5bb9\u7684\u6570\u91cf&gt;<\/p>\n<p>  # \u7f29\u5bb9<br \/>\n  spec:<br \/>\n    replicas:&lt;\u4f60\u671f\u5f85\u7684\u7f29\u5bb9\u7684\u6570\u91cf&gt; <\/p>\n<p>\u4ee5\u4e0a\u63d0\u4f9b\u7684\u4e24\u4e2a\u65b9\u6cd5\u90fd\u53ef\u4ee5\u6700\u7ec8\u5b9e\u73b0\u5bf9StatefulSet\u7684\u6269\u5bb9\u548c\u7f29\u5bb9\u7684\u64cd\u4f5c&#xff0c;\u6700\u7ec8\u53ef\u901a\u8fc7&#xff1a;<\/p>\n<p>  # \u67e5\u770b\u5177\u4f53 StatefulSet<br \/>\n  kubectl get statefulset &lt;\u4f60\u7684statefulset\u540d\u79f0&gt;<br \/>\n  # \u6216\u8005\u76f4\u63a5\u67e5\u770b\u6240\u6709 Pod<br \/>\n  kubectl get po<br \/>\n  # \u6216\u8005\u76f4\u63a5\u67e5\u770b\u6240\u6709 StatefulSet<br \/>\n  kubectl get sts <\/p>\n<p>\u90fd\u53ef\u4ee5\u67e5\u770b\u5230\u73b0\u5728\u7684Pod\u526f\u672c\u6570\u91cf\u662f\u5426\u6210\u529f\u6269\u5bb9\u548c\u7f29\u5bb9<\/p>\n<h4 id=\"%E5%85%AD%E3%80%81%E6%9B%B4%E6%96%B0%E7%AD%96%E7%95%A5\">\u516d\u3001\u66f4\u65b0\u7b56\u7565<\/h4>\n<h5 id=\"1%E3%80%81RollingUpdate(%E6%BB%9A%E5%8A%A8%E6%9B%B4%E6%96%B0)\">1\u3001RollingUpdate(\u6eda\u52a8\u66f4\u65b0)<\/h5>\n<p>StatefulSet\u7684\u6eda\u52a8\u66f4\u65b0\u76f8\u8f83\u4e8eDeployment\u7684\u6eda\u52a8\u66f4\u65b0\u4f1a\u591a\u4e00\u4e2a\u6709\u5e8f\u7684\u7279\u5b9a&#xff0c;\u5373StatefulSet\u7684\u6eda\u52a8\u66f4\u65b0\u7684\u6309\u7167\u4f60\u5bb9\u5668\u7684\u521b\u5efa\u987a\u5e8f&#xff0c;\u4ece<span style=\"background-color:#fefcd8\">\u5bb9\u5668\u7684\u6700\u9ad8\u5e8f\u53f7<\/span>\u5f00\u59cb\u8fdb\u884c\u66f4\u65b0&#xff0c;\u66f4\u65b0\u5b8c\u4e00\u4e2a\u5220\u9664\u4e00\u4e2a&#xff0c;\u4e4b\u540e\u518d\u8fdb\u884c\u4e0b\u4e00\u4e2a\u7684\u66f4\u65b0&#xff0c;\u800cDeployment\u7684\u6eda\u52a8\u66f4\u65b0\u662f\u968f\u673a\u7684&#xff0c;\u65e0\u5e8f\u7684\u3002<\/p>\n<table>\n<tr>\u7ef4\u5ea6Deployment \u6eda\u52a8\u66f4\u65b0StatefulSet \u6eda\u52a8\u66f4\u65b0<\/tr>\n<tbody>\n<tr>\n<td>\u66f4\u65b0\u5355\u4f4d<\/td>\n<td>\u4efb\u610f Pod \u5e76\u884c\u66ff\u6362&#xff0c;\u65e0\u987a\u5e8f\u8981\u6c42<\/td>\n<td>\u5fc5\u987b\u4ece\u6700\u9ad8\u5e8f\u53f7\u5f00\u59cb\u9006\u5e8f\u66ff\u6362&#xff08;pod-N \u2192 pod-N-1 \u2026&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Pod \u540d\u5b57<\/td>\n<td>\u968f\u673a\u540e\u7f00&#xff0c;\u66f4\u65b0\u540e\u5b8c\u5168\u6362\u65b0 Pod \u540d<\/td>\n<td>\u4fdd\u6301 \u539f\u6765\u7684\u540d\u5b57 \u4e0d\u53d8&#xff0c;\u53ea\u662f\u91cd\u542f&#043;\u65b0\u6a21\u677f<\/td>\n<\/tr>\n<tr>\n<td>\u7f51\u7edc\u6807\u8bc6<\/td>\n<td>IP \u4f1a\u53d8&#xff1b;Service \u901a\u8fc7 label \u9009\u4e2d\u65b0 Pod<\/td>\n<td>DNS \u8bb0\u5f55 (name-ordinal.svc.cluster.local) \u7a33\u5b9a\u4e0d\u53d8<\/td>\n<\/tr>\n<tr>\n<td>PVC \u6570\u636e<\/td>\n<td>\u91cd\u65b0\u8c03\u5ea6\u65f6 PVC \u53ef\u80fd\u88ab\u5176\u4ed6 Pod \u590d\u7528<\/td>\n<td>\u6bcf\u4e2a\u5e8f\u53f7\u4e13\u5c5e PVC&#xff0c;\u66f4\u65b0\u540e\u4ecd\u6302\u8f7d\u540c\u4e00\u4efd\u6570\u636e<\/td>\n<\/tr>\n<tr>\n<td>\u5e76\u53d1\u63a7\u5236<\/td>\n<td>maxSurge\/maxUnavailable \u53ef\u540c\u65f6\u521b\u5efa\u591a Pod<\/td>\n<td>\u4e00\u6b21\u53ea\u52a8\u4e00\u4e2a Pod&#xff08;\u65e0\u6cd5\u5e76\u884c&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>\u5206\u533a\u66f4\u65b0<\/td>\n<td>\u4e0d\u652f\u6301<\/td>\n<td>\u652f\u6301 partition&#xff0c;\u53ef\u5b9e\u73b0 \u91d1\u4e1d\u96c0\/\u84dd\u7eff \u6548\u679c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u6eda\u52a8\u66f4\u65b0\u662f\u4e00\u6b21\u6027\u66f4\u65b0&#xff0c;\u800c\u4e0a\u65b9\u8868\u683c\u63d0\u5230\u7684\u91d1\u4e1d\u96c0\/\u84dd\u7eff\u6548\u679c\u662fStatefulSet\u8f83\u4e3a\u7279\u6b8a\u7684\u90e8\u5206&#xff0c;\u91d1\u4e1d\u96c0\u53d1\u5e03&#xff08;\u53c8\u79f0\u7070\u5ea6\u53d1\u5e03&#xff09;\u5148\u90e8\u7f72\u5c11\u91cf\u65b0\u526f\u672c&#xff08;\u5982 2 \u4e2a&#xff09;&#xff0c;\u628a\u90e8\u5206\u6d41\u91cf\u5f15\u8fc7\u53bb\u505a\u7070\u5ea6\u9a8c\u8bc1&#xff0c;\u786e\u4fdd\u5b89\u5168\u540e&#xff0c;\u518d \u9010\u6b65\u653e\u5927 \u65b0\u526f\u672c\u6570\u3001\u7f29\u5c0f\u65e7\u526f\u672c\u6570&#xff0c;\u76f4\u5230 100% \u5b8c\u6210&#xff0c;\u800c\u84dd\u7eff\u90e8\u7f72\u5219\u662f\u9700\u8981\u4e24\u5957\u73af\u5883&#xff0c;\u4e00\u952e\u5207\u6362<\/p>\n<table>\n<tr>\u7ef4\u5ea6\u84dd\u7eff\u90e8\u7f72&#xff08;Blue\/Green&#xff09;\u91d1\u4e1d\u96c0\u53d1\u5e03&#xff08;Canary&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u6838\u5fc3\u601d\u60f3<\/td>\n<td>\u4e24\u5957\u5b8c\u5168\u72ec\u7acb\u7684\u73af\u5883&#xff08;\u84dd\/\u7eff&#xff09;&#xff0c;\u6d41\u91cf\u4e00\u6b21\u6027\u6216\u77ac\u65f6\u5207\u6362<\/td>\n<td>\u628a\u65b0\u7248\u672c\u5148\u66b4\u9732\u7ed9\u5c11\u91cf\u7528\u6237&#xff0c;\u9010\u6b65\u653e\u5927\u6d41\u91cf\u6bd4\u4f8b<\/td>\n<\/tr>\n<tr>\n<td>\u8d44\u6e90\u6210\u672c<\/td>\n<td>\u9ad8&#xff1a;\u9700\u8981 2 \u4efd\u5168\u91cf\u8d44\u6e90<\/td>\n<td>\u4f4e&#xff1a;\u4ec5\u7528\u589e\u91cf\u526f\u672c<\/td>\n<\/tr>\n<tr>\n<td>\u5207\u6362\u901f\u5ea6<\/td>\n<td>\u79d2\u7ea7\u5207\u6362&#xff08;\u6539 Service Selector \u6216 Ingress \u6743\u91cd&#xff09;<\/td>\n<td>\u5206\u949f\u7ea7&#xff5e;\u5c0f\u65f6\u7ea7&#xff0c;\u6309\u9636\u6bb5\u653e\u91cf<\/td>\n<\/tr>\n<tr>\n<td>\u56de\u6eda\u96be\u5ea6<\/td>\n<td>\u4e00\u952e\u5207\u56de\u65e7\u73af\u5883<\/td>\n<td>\u8c03\u4f4e\u6d41\u91cf\u6bd4\u4f8b\u6216\u76f4\u63a5\u5220\u9664\u91d1\u4e1d\u96c0\u526f\u672c\u5373\u53ef<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u5bf9\u4e1a\u52a1\u8fde\u7eed\u6027\u8981\u6c42\u6781\u9ad8\u3001\u8d44\u6e90\u5145\u8db3\u7684\u7cfb\u7edf<\/td>\n<td>\u9700\u8981\u7070\u5ea6\u9a8c\u8bc1\u3001\u9010\u6b65\u653e\u91cf\u7684\u4e92\u8054\u7f51\u670d\u52a1<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h6 id=\"%E2%91%A0%E3%80%81%E7%AE%80%E5%8D%95%E6%BB%9A%E5%8A%A8%E6%9B%B4%E6%96%B0\">\u2460\u3001\u7b80\u5355\u6eda\u52a8\u66f4\u65b0<\/h6>\n<p>Pod \u6a21\u677f\u4efb\u4f55\u5b57\u6bb5&#xff08;env\u3001volume\u3001\u8d44\u6e90\u9650\u5236\u3001\u6807\u7b7e\u7b49&#xff09;\u53d1\u751f\u53d8\u5316&#xff0c;StatefulSet \u5c31\u4f1a\u6309 \u6709\u5e8f\u6eda\u52a8 \u7b56\u7565\u9010\u4e2a\u66ff\u6362 Pod<\/p>\n<p>  template:<br \/>\n  # &#8230;&#8230;<br \/>\n    spec:<br \/>\n  # &#8230;&#8230;<br \/>\n        env: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u5b9a\u4e49\u73af\u5883\u53d8\u91cf<br \/>\n   \u00a0 \u00a0 \u00a0  &#8211; name: MYSQL_ROOT_PASSWORD #\u73af\u5883\u53d8\u91cf\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u8bbe\u7f6e MySQL \u7684 root \u5bc6\u7801<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0  value: &#034;123&#034; \u00a0 \u00a0 \u00a0 \u00a0 #&#034;123456&#034; \u2014\u2014&gt; &#034;123&#034; <\/p>\n<p>\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u53ef\u67e5\u770b\u6709\u5e8f\u6eda\u52a8&#xff1a;<\/p>\n<p>  # \u5b9e\u65f6\u76d1\u63a7&#xff0c;\u8bb0\u4f4f\u4fee\u6539\u5b8c\u540e\u5c31\u9a6c\u4e0a\u4f7f\u7528&#xff0c;\u6216\u53cc\u5f00\u865a\u62df\u673a\u67e5\u770b<br \/>\n  kubectl get pods -l app&#061;mysql -w<br \/>\n  \u200b<br \/>\n  # \u53ef\u67e5\u770b\u65e5\u5fd7Events<br \/>\n  kubectl describe sts &lt;\u4f60\u81ea\u5df1\u7684statefulset\u540d\u79f0&gt;<br \/>\n  \u200b<br \/>\n  # \u53ea\u60f3\u67e5\u770b\u6700\u7ec8\u7ed3\u679c\u72b6\u6001<br \/>\n  kubectl rollout status statefulset\/&lt;\u4f60\u81ea\u5df1\u7684statefulset\u540d\u79f0&gt;<br \/>\n  \u200b<br \/>\n  # \u6216\u8005\u76f4\u63a5\u67e5\u770b\u662f\u5426\u5168\u90e8READY<br \/>\n  kubectl get po <\/p>\n<p>\u90e8\u5206\u7ed3\u679c\u7c7b\u4f3c\u5982\u4e0b\u56fe&#xff1a;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"281\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082025-689eedc9d595e.png\" width=\"1593\" \/><\/p>\n<h6 id=\"%E2%91%A1%E3%80%81%E9%87%91%E4%B8%9D%E9%9B%80%E5%8F%91%E5%B8%83\">\u2461\u3001\u91d1\u4e1d\u96c0\u53d1\u5e03<\/h6>\n<p>\u73b0\u5728\u53ea\u66f4\u65b0<span style=\"color:#fe2c24\">\u5e8f\u53f7\u5927\u4e8e\u7b49\u4e8epartition<\/span>\u7684Pod<\/p>\n<p>  template:<br \/>\n  # &#8230;&#8230;<br \/>\n    spec:<br \/>\n  # &#8230;&#8230;<br \/>\n        env: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u5b9a\u4e49\u73af\u5883\u53d8\u91cf<br \/>\n   \u00a0 \u00a0 \u00a0  &#8211; name: MYSQL_ROOT_PASSWORD #\u73af\u5883\u53d8\u91cf\u540d\u79f0&#xff08;\u81ea\u5b9a\u4e49&#xff09;<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u8bbe\u7f6e MySQL \u7684 root \u5bc6\u7801<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0  value: &#034;123456&#034; \u00a0 \u00a0 \u00a0 \u00a0 #&#034;123&#034; \u2014\u2014&gt; &#034;123456&#034;<br \/>\n   \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<br \/>\n  updateStrategy: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u66f4\u65b0\u7b56\u7565&#xff0c;\u548c Pod \u6a21\u677f\u540c\u7ea7<br \/>\n   \u00a0  type: RollingUpdate \u00a0 \u00a0 \u00a0 \u00a0#\u66f4\u65b0\u7b56\u7565\u7c7b\u578b&#xff0c;\u8fd9\u91cc\u662f\u6eda\u52a8\u66f4\u65b0<br \/>\n   \u00a0  rollingUpdate:<br \/>\n   \u00a0 \u00a0  partition: 1 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #&#034;0&#034; \u2014\u2014&gt; &#034;1&#034; <\/p>\n<p>\u4e4b\u540e\u4fdd\u5b58\u5e76\u67e5\u770b\u66f4\u65b0\u6548\u679c&#xff1a;<\/p>\n<p>  # \u5e94\u7528yaml\u6587\u4ef6<br \/>\n  kubectl apply -f mysql-statefulset1.yaml<br \/>\n  \u200b<br \/>\n  # \u5b9e\u65f6\u76d1\u63a7<br \/>\n  kubectl get pods -l app&#061;mysql -w <\/p>\n<p>\u53ef\u5f97\u5230\u7c7b\u4f3c\u6548\u679c&#xff1a;&#xff08;\u5f53\u7136\u7531\u4e8e\u6211\u5fd8\u8bb0\u53cc\u5f00&#xff0c;\u6ca1\u6709\u5728\u521a\u5e94\u7528\u6587\u4ef6\u7684\u65f6\u5019\u5c31\u67e5\u770b&#xff0c;\u6240\u4ee5\u53ea\u76d1\u63a7\u5230\u4e86\u90e8\u5206&#xff09;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"454\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082029-689eedcd9df71.png\" width=\"1600\" \/><\/p>\n<p>\u5f53\u7136\u4e5f\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b3\u4e2a Pod \u5bb9\u5668\u7684MYSQL\u7684\u5bc6\u7801\u6765\u9a8c\u8bc1\u662f\u5426\u53ea\u66f4\u65b0\u4e86&gt;&#061;partition(1)\u7684\u5bb9\u5668&#xff1a;<\/p>\n<p>  # \u67e5\u770b\u7b2c\u4e00\u4e2a\u66f4\u65b0\u7684\u5bb9\u5668<br \/>\n  # \u6ce8\u610f\u8fd9\u91cc\u7684mysql-statefulset1-2\u662f\u6211\u7684\u6700\u9ad8\u5e8f\u53f7\u7684\u5bb9\u5668&#xff0c;\u4f60\u5e94\u8be5\u586b\u5199\u81ea\u5df1\u7684<br \/>\n  kubectl describe po mysql-statefulset1-2<br \/>\n  # \u67e5\u770b\u5269\u4e0b\u7684\u5bb9\u5668<br \/>\n  kubectl describe po mysql-statefulset1-1<br \/>\n  kubectl describe po mysql-statefulset1-0 <\/p>\n<p>\u7ed3\u679c\u5982\u56fe&#xff1a;<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"771\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082034-689eedd27c638.png\" width=\"1600\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"833\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082041-689eedd93f330.png\" width=\"1600\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"810\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082047-689eeddf1d033.png\" width=\"1600\" \/><\/p>\n<p>\u7531\u6b64\u53ef\u89c1&#xff1a;\u662f<span style=\"color:#fe2c24\">\u9006\u5e8f\u6eda\u52a8\u66f4\u65b0&#xff0c;\u4e14\u91d1\u4e1d\u96c0\u53d1\u5e03\u53ea\u66f4\u65b0\u5927\u4e8e\u7b49\u4e8epartition\u7684\u5bb9\u5668<\/span><\/p>\n<p>\u84dd\u7eff\u90e8\u7f72\u73b0\u5728\u4e0d\u6f14\u793a&#xff0c;\u5728\u4e4b\u540e\u7684\u5185\u5bb9\u518d\u5c55\u5f00<\/p>\n<h5 id=\"2%E3%80%81OnDelete%EF%BC%88%E5%88%A0%E9%99%A4%E6%9B%B4%E6%96%B0%EF%BC%89\">2\u3001OnDelete&#xff08;\u5220\u9664\u66f4\u65b0&#xff09;<\/h5>\n<p>StatefulSet\u7684OnDelete\u8868\u793a&#xff1a;\u6309\u6b63\u5e38\u6765\u8bf4Pod \u6a21\u677f\u4efb\u4f55\u5b57\u6bb5&#xff08;env\u3001volume\u3001\u8d44\u6e90\u9650\u5236\u3001\u6807\u7b7e\u7b49&#xff09;\u53d1\u751f\u53d8\u5316&#xff0c;StatefulSet \u5c31\u4f1a\u8fdb\u884c\u6eda\u52a8\u66f4\u65b0&#xff0c;\u4f46\u662f\u5982\u679c\u4f60\u5c06\u66f4\u65b0\u7b56\u7565\u6539\u4e3aOnDelete&#xff0c;\u90a3\u4e48\u5373\u4f7f\u5417\u4fee\u6539\u4e86Pod\u6a21\u677f\u5e76\u4fdd\u5b58yaml\u6587\u4ef6&#xff0c;\u4f60\u7684\u5bb9\u5668\u4e5f\u4e0d\u4f1a\u66f4\u65b0\u3002\u53ea\u6709\u5f53\u4f60\u5220\u9664\u5bb9\u5668&#xff0c;\u88ab\u4f60\u5220\u9664\u7684\u5bb9\u5668\u5c31\u4f1a\u8fdb\u884c\u66f4\u65b0\u5e76\u4e14\u7acb\u9a6c\u91cd\u5efa\u3002<\/p>\n<p>\u5728\u4e0a\u4e00\u7ea7\u7684RollingUpdate\u4e2d\u6211\u5df2\u7ecf\u66f4\u65b0\u4e86\u5e8f\u53f72\u548c1\u7684\u5bb9\u5668&#xff0c;\u5e8f\u53f7\u4e3a0\u7684\u5bb9\u5668\u7684MySQL\u5bc6\u7801\u8fd8\u662f123&#xff0c;\u63a5\u4e0b\u6765\u6211\u5c06\u4f7f\u7528OnDelete\u6765\u66f4\u65b0\u5e8f\u53f7\u4e3a0\u7684\u5bb9\u5668&#xff0c;\u4f7f\u5b83\u7684MySQL\u5bc6\u7801\u53d8\u4e3a123456<\/p>\n<p>  updateStrategy: \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 #\u66f4\u65b0\u7b56\u7565&#xff0c;\u548c Pod \u6a21\u677f\u540c\u7ea7<br \/>\n   \u00a0  type: OnDelete \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#\u66f4\u65b0\u7b56\u7565\u7c7b\u578b&#xff0c;\u8fd9\u91cc\u662f\u5220\u9664\u66f4\u65b0 <\/p>\n<p>\u4e4b\u540e\u5e94\u7528\u6587\u4ef6\u5e76\u5220\u9664\u5e8f\u53f7\u4e3a0\u7684\u5bb9\u5668&#xff0c;\u4f60\u4f1a\u53d1\u73b0&#xff0c;\u5bb9\u5668\u88ab\u5220\u9664\u540e\u9a6c\u4e0a\u521b\u5efa&#xff0c;\u518d\u6b21\u8fdb\u5165\u5bb9\u5668&#xff0c;\u53d1\u73b0\u5bc6\u7801\u662f123456<\/p>\n<p>  # \u5e94\u7528\u6587\u4ef6<br \/>\n  kubectl apply -f mysql-statefulset1.yaml<br \/>\n  \u200b<br \/>\n  # \u5220\u9664\u5e8f\u53f7\u4e3a0\u7684\u5bb9\u5668<br \/>\n  # \u6ce8\u610f\u8fd9\u91cc\u7684mysql-statefulset1-9\u662f\u6211\u7684\u5e8f\u53f7\u4e3a0\u7684\u5bb9\u5668&#xff0c;\u4f60\u5e94\u8be5\u586b\u5199\u81ea\u5df1\u7684<br \/>\n  kubectl delete po mysql-statefulset1-0 <\/p>\n<h4 id=\"%E2%80%8B%E7%BC%96%E8%BE%91\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"1002\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082052-689eede43270a.png\" width=\"1600\" \/><\/h4>\n<h4 id=\"%E4%B8%83%E3%80%81%E5%88%A0%E9%99%A4\">\u4e03\u3001\u5220\u9664<\/h4>\n<p>\u5220\u9664\u5927\u81f4\u53ef\u5206\u4e3a\u4e24\u79cd&#xff1a;\u300c\u7ea7\u8054\u5220\u9664\u300d(Cascading) \u548c \u300c\u975e\u7ea7\u8054\u5220\u9664\u300d(Orphan) \u51b3\u5b9a\u4e86\u201c\u5220\u63a7\u5236\u5668\u65f6&#xff0c;\u5b83\u7ba1\u7406\u7684 Pod \u5bb9\u5668\u600e\u4e48\u529e\u201d<\/p>\n<table>\n<tr>\u7ef4\u5ea6\u7ea7\u8054\u5220\u9664&#xff08;Cascading&#xff09;\u975e\u7ea7\u8054\u5220\u9664&#xff08;Orphan \/ \u975e\u7ea7\u8054&#xff09;<\/tr>\n<tbody>\n<tr>\n<td>\u9ed8\u8ba4\u884c\u4e3a<\/td>\n<td>\u9ed8\u8ba4&#xff08;\u4e0d\u989d\u5916\u52a0\u53c2\u6570&#xff09;<\/td>\n<td>\u9700\u8981\u663e\u5f0f\u52a0 &#8211;cascade&#061;orphan \u6216 &#8211;cascade&#061;false<\/td>\n<\/tr>\n<tr>\n<td>\u5220\u9664\u7ed3\u679c<\/td>\n<td>\u63a7\u5236\u5668 &#043; \u6240\u6709 Pod \u4e00\u5e76\u5220\u9664<\/td>\n<td>\u53ea\u5220\u63a7\u5236\u5668&#xff0c;Pod \u53d8\u6210\u5b64\u513f&#xff08;Orphan&#xff09;\u7ee7\u7eed\u8fd0\u884c<\/td>\n<\/tr>\n<tr>\n<td>PVC\/Service<\/td>\n<td>\u4e0d\u53d7\u5f71\u54cd&#xff1b;PVC \u9ed8\u8ba4\u4fdd\u7559<\/td>\n<td>\u540c\u4e0a<\/td>\n<\/tr>\n<tr>\n<td>\u5178\u578b\u547d\u4ee4<\/td>\n<td>kubectl delete sts mysql<\/td>\n<td>kubectl delete sts mysql &#8211;cascade&#061;orphan<\/td>\n<\/tr>\n<tr>\n<td>\u9002\u7528\u573a\u666f<\/td>\n<td>\u5feb\u901f\u6e05\u7406\u6574\u4e2a\u5e94\u7528<\/td>\n<td>\u53ea\u60f3\u5220\u63a7\u5236\u5668&#xff0c;\u4fdd\u7559\u4e1a\u52a1 Pod \u505a\u8c03\u8bd5\u6216\u8fc1\u79fb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb415\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u5728k8sday06\u7684\u5b66\u4e60\u4e2d\u6211\u4eec\u5df2\u7ecf\u5b66\u4e60\u4e86\u65e0\u72b6\u6001\u5e94\u7528\u5e38\u7528\u7684\u63a7\u5236\u5668\u2014\u2014Deployment\u5728\u4eca\u5929\u7684\u5b66\u4e60\u4e2d\u6211\u5c06\u4f1a\u7ee7\u7eed\u5b66\u4e60\u6709\u72b6\u6001\u5e94\u7528\u7684\u63a7\u5236\u5668\u2014\u2014<\/p>\n","protected":false},"author":2,"featured_media":57612,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[5318,120,763,121,43],"topic":[],"class_list":["post-57621","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-k8s","tag-kubernetes","tag-763","tag-121","tag-43"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/57621.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb415\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u5728k8sday06\u7684\u5b66\u4e60\u4e2d\u6211\u4eec\u5df2\u7ecf\u5b66\u4e60\u4e86\u65e0\u72b6\u6001\u5e94\u7528\u5e38\u7528\u7684\u63a7\u5236\u5668\u2014\u2014Deployment\u5728\u4eca\u5929\u7684\u5b66\u4e60\u4e2d\u6211\u5c06\u4f1a\u7ee7\u7eed\u5b66\u4e60\u6709\u72b6\u6001\u5e94\u7528\u7684\u63a7\u5236\u5668\u2014\u2014\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/57621.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-15T08:21:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082009-689eedb946809.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57621.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/57621.html\",\"name\":\"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-08-15T08:21:00+00:00\",\"dateModified\":\"2025-08-15T08:21:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/57621.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/57621.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/57621.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/57621.html","og_locale":"zh_CN","og_type":"article","og_title":"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb415\u6b21\uff0c\u70b9\u8d5e5\u6b21\uff0c\u6536\u85cf2\u6b21\u3002\u5728k8sday06\u7684\u5b66\u4e60\u4e2d\u6211\u4eec\u5df2\u7ecf\u5b66\u4e60\u4e86\u65e0\u72b6\u6001\u5e94\u7528\u5e38\u7528\u7684\u63a7\u5236\u5668\u2014\u2014Deployment\u5728\u4eca\u5929\u7684\u5b66\u4e60\u4e2d\u6211\u5c06\u4f1a\u7ee7\u7eed\u5b66\u4e60\u6709\u72b6\u6001\u5e94\u7528\u7684\u63a7\u5236\u5668\u2014\u2014","og_url":"https:\/\/www.wsisp.com\/helps\/57621.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-08-15T08:21:00+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/08\/20250815082009-689eedb946809.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/57621.html","url":"https:\/\/www.wsisp.com\/helps\/57621.html","name":"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-08-15T08:21:00+00:00","dateModified":"2025-08-15T08:21:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/57621.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/57621.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/57621.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"k8sday06\u6df1\u5165\u63a7\u5236\u5668\uff082\/3\uff09"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57621","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=57621"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/57621\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/57612"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=57621"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=57621"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=57621"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=57621"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}