{"id":19583,"date":"2024-11-19T13:48:35","date_gmt":"2024-11-19T05:48:35","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19583\/"},"modified":"2024-11-19T13:48:35","modified_gmt":"2024-11-19T05:48:35","slug":"k8s%e4%b8%8a%e6%80%8e%e4%b9%88%e5%ae%89%e8%a3%85gitlab%e5%b9%b6%e8%8e%b7%e5%8f%96%e5%88%9d%e5%a7%8b%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19583\/","title":{"rendered":"k8s\u4e0a\u600e\u4e48\u5b89\u88c5gitlab\u5e76\u83b7\u53d6\u521d\u59cb\u5bc6\u7801"},"content":{"rendered":"<p>kubernetes\uff08\u7b80\u79f0k8s\uff09\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5bb9\u5668\u7f16\u6392\u5e73\u53f0\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u6269\u5c55\u3001\u7ba1\u7406\u548c\u90e8\u7f72\u5bb9\u5668\u5316\u5e94\u7528\u7a0b\u5e8f\u3002\u800cgitlab\u662f\u4e00\u4e2a\u57fa\u4e8eweb\u7684git\u5b58\u50a8\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406\u548c\u5206\u4eab\u4f60\u7684\u4ee3\u7801\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u5982\u4f55\u5728kubernetes\u96c6\u7fa4\u4e0a\u5b89\u88c5gitlab\uff0c\u5e76\u83b7\u53d6\u5176\u521d\u59cb\u5bc6\u7801\u3002<\/p>\n<ol>\n<li>\u524d\u63d0\u6761\u4ef6<\/li>\n<\/ol>\n<p>\u5728\u5f00\u59cb\u5b89\u88c5Gitlab\u4e4b\u524d\uff0c\u786e\u4fdd\u4f60\u7684Kubernetes\u96c6\u7fa4\u5df2\u7ecf\u5b8c\u6210\u914d\u7f6e\uff0c\u5e76\u4e14\u5df2\u7ecf\u542f\u7528\u4e86Helm\u3002<\/p>\n<ol>\n<li>\u4e0b\u8f7dGitlab<\/li>\n<\/ol>\n<p>\u9996\u5148\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5728Kubernetes\u96c6\u7fa4\u4e0a\u90e8\u7f72Gitlab Helm Chart\u3002<\/p>\n<pre>helm repo add gitlab https:\/\/charts.gitlab.io\/\nhelm install gitlab gitlab\/gitlab \n  --namespace gitlab \n  --set global.hosts.domain=example.com \n  --set certmanager-issuer.email=you@example.com \n  --set gitlab-runner.runners.privileged=true \n  --set gitlab-runner.runners.image=runner:latest \n  --set gitlab-runner.runners.cache.storePath=\/cache \n  --set gitlab-runner.runners.cache.type=s3 \n  --set gitlab-runner.runners.cache.bucketName=my-bucket \n  --set gitlab-runner.runners.cache.s3.region=eu-west-1 \n  --set gitlab-runner.runners.cache.shared=true<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e0a\u8ff0\u547d\u4ee4\u5c06\u5b89\u88c5Gitlab Helm Chart\uff0c\u5e76\u5c06Gitlab\u5b9e\u4f8b\u7684\u57df\u540d\u8bbe\u7f6e\u4e3aexample.com\u3002<\/p>\n<ol>\n<li>\u83b7\u53d6\u521d\u59cb\u5bc6\u7801<\/li>\n<\/ol>\n<p>\u5728\u6210\u529f\u90e8\u7f72Gitlab\u540e\uff0c\u4f60\u9700\u8981\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u83b7\u53d6Gitlab\u7684\u521d\u59cb\u5bc6\u7801\u3002<\/p>\n<pre>kubectl get secret gitlab-gitlab-initial-root-password -ojsonpath='{.data.password}' | base64 --decode ; echo<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd0\u884c\u547d\u4ee4\u540e\uff0c\u4f60\u5c06\u83b7\u5f97Gitlab\u7684\u521d\u59cb\u5bc6\u7801\u3002<\/p>\n<ol>\n<li>\u767b\u5f55\u5230Gitlab<\/li>\n<\/ol>\n<p>\u73b0\u5728\uff0c\u4f7f\u7528\u521d\u59cb\u5bc6\u7801\u767b\u5f55\u5230Gitlab\u5e76\u521b\u5efa\u7ba1\u7406\u5458\u8d26\u53f7\u3002\u8f93\u5165\u521d\u59cb\u5bc6\u7801\u540e\uff0c\u7cfb\u7edf\u5c06\u63d0\u793a\u4f60\u8bbe\u7f6e\u65b0\u7684\u5bc6\u7801\u3002<\/p>\n<ol>\n<li>\u7ed3\u8bba<\/li>\n<\/ol>\n<p>\u73b0\u5728\uff0cGitlab\u5df2\u7ecf\u5728Kubernetes\u96c6\u7fa4\u4e0a\u6210\u529f\u5b89\u88c5\uff0c\u5e76\u4e14\u4f60\u5df2\u7ecf\u6210\u529f\u83b7\u53d6\u4e86\u5176\u521d\u59cb\u5bc6\u7801\u3002\u5728\u8fd9\u91cc\uff0c\u4f60\u53ef\u4ee5\u76f4\u63a5\u767b\u5f55\u5e76\u4f7f\u7528Gitlab\u7ba1\u7406\u4f60\u7684\u4ee3\u7801\u5e93\uff0c\u5b9e\u73b0\u56e2\u961f\u534f\u4f5c\u548c\u7248\u672c\u63a7\u5236\u3002<\/p>\n<p>\u603b\u4f53\u6765\u8bf4\uff0c\u5b89\u88c5Gitlab\u5e76\u4e0d\u96be\uff0c\u4f46\u8981\u4e86\u89e3\u5982\u4f55\u6b63\u786e\u914d\u7f6eKubernetes\u548cHelm\uff0c\u5e76\u83b7\u53d6\u521d\u59cb\u5bc6\u7801\u3002\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u80fd\u591f\u5e2e\u52a9\u4f60\u6210\u529f\u5b89\u88c5\u548c\u4f7f\u7528Gitlab\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fk8s\u4e0a\u600e\u4e48\u5b89\u88c5gitlab\u5e76\u83b7\u53d6\u521d\u59cb\u5bc6\u7801\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>kubernetes\uff08\u7b80\u79f0k8s\uff09\u662f\u4e00\u79cd\u6d41\u884c\u7684\u5bb9\u5668\u7f16\u6392\u5e73\u53f0\uff0c\u53ef\u4ee5\u8f7b\u677e\u5730\u6269\u5c55\u3001\u7ba1\u7406\u548c\u90e8\u7f72\u5bb9\u5668\u5316\u5e94\u7528\u7a0b\u5e8f\u3002\u800cgitlab\u662f\u4e00\u4e2a\u57fa\u4e8eweb\u7684git\u5b58\u50a8\u5e93\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u8f7b\u677e\u7ba1\u7406\u548c\u5206\u4eab\u4f60\u7684\u4ee3\u7801\u3002\u5728\u8fd9\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8ba8\u8bba\u5982\u4f55\u5728kubernetes\u96c6\u7fa4\u4e0a\u5b89\u88c5gitlab\uff0c\u5e76\u83b7\u53d6\u5176\u521d\u59cb\u5bc6\u7801\u3002 \u524d\u63d0\u6761\u4ef6 \u5728\u5f00\u59cb\u5b89\u88c5Gitlab\u4e4b\u524d\uff0c\u786e\u4fdd\u4f60\u7684Kubernetes\u96c6\u7fa4\u5df2\u7ecf\u5b8c\u6210\u914d\u7f6e\uff0c\u5e76\u4e14\u5df2\u7ecf\u542f\u7528\u4e86Helm\u3002 \u4e0b\u8f7dGitlab \u9996\u5148\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5728Kubernetes\u96c6\u7fa4\u4e0a\u90e8\u7f72Gitlab Helm Chart\u3002 helm repo add gitlab https:\/\/charts.gitlab.io\/ helm install gitlab gitlab\/gitlab &#8211;namespace gitlab &#8211;set global.hosts.domain=example.com &#8211;set certmanager-issuer.email=you@example.com &#8211;set gitlab-runner.runners.privileged=true &#8211;set gitlab-runner.runners.image=runner:latest &#8211;set gitlab-runner.runners.cache.storePath=\/cache &#8211;set gitlab-runner.runners.cache.type=s3 &#8211;set gitlab-runner.runners.cache.bucketName=my-bucket &#8211;set gitlab-runner.runners.cache.s3.region=eu-west-1 &#8211;set gitlab-runner.runners.cache.shared=true \u767b\u5f55\u540e\u590d\u5236 \u4e0a\u8ff0\u547d\u4ee4\u5c06\u5b89\u88c5Gitlab Helm Chart\uff0c\u5e76\u5c06Gitlab\u5b9e\u4f8b\u7684\u57df\u540d\u8bbe\u7f6e\u4e3aexample.com\u3002 \u83b7\u53d6\u521d\u59cb\u5bc6\u7801 \u5728\u6210\u529f\u90e8\u7f72Gitlab\u540e\uff0c\u4f60\u9700\u8981\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u83b7\u53d6Gitlab\u7684\u521d\u59cb\u5bc6\u7801\u3002 kubectl get secret gitlab-gitlab-initial-root-password -ojsonpath='{.data.password}&#8217; | base64 &#8211;decode ; echo \u767b\u5f55\u540e\u590d\u5236 \u8fd0\u884c\u547d\u4ee4\u540e\uff0c\u4f60\u5c06\u83b7\u5f97Gitlab\u7684\u521d\u59cb\u5bc6\u7801\u3002 \u767b\u5f55\u5230Gitlab [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19583","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19583","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19583"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19583\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19583"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}