{"id":593,"date":"2025-01-10T15:38:14","date_gmt":"2025-01-10T07:38:14","guid":{"rendered":"https:\/\/blog.doublejia.cn\/?p=593"},"modified":"2025-01-10T15:42:08","modified_gmt":"2025-01-10T07:42:08","slug":"k3s%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0","status":"publish","type":"post","link":"https:\/\/blog.doublejia.cn\/?p=593","title":{"rendered":"K3S\u5b66\u4e60\u7b14\u8bb0"},"content":{"rendered":"\n<p>1.\u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -sfL https:\/\/rancher-mirror.rancher.cn\/k3s\/k3s-install.sh | INSTALL_K3S_MIRROR=cn sh -<\/code><\/pre>\n\n\n\n<p>\u589e\u52a0 node \u65f6\u53ef\u4ee5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -sfL https:\/\/rancher-mirror.rancher.cn\/k3s\/k3s-install.sh | INSTALL_K3S_MIRROR=cn K3S_URL=https:\/\/myserver:6443 K3S_TOKEN=mynodetoken sh -<\/code><\/pre>\n\n\n\n<p>\u67e5\u770btoken<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/var\/lib\/rancher\/k3s\/server\/node-token<\/code><\/pre>\n\n\n\n<p>2. \u8bbe\u7f6e docker \u7684\u56fd\u5185\u955c\u50cf<\/p>\n\n\n\n<p>k3s \u6587\u4ef6\uff1a\/etc\/rancher\/k3s\/registries.yaml<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mirrors:\n  docker.io:\n    endpoint:\n      - \"https:\/\/docker.1panel.live\"\n      - \"https:\/\/registry.cn-hangzhou.aliyuncs.com\/\"\n  quay.io:\n    endpoint:\n      - \"https:\/\/quay.tencentcloudcr.com\/\"\n  registry.k8s.io:\n    endpoint:\n      - \"https:\/\/registry.aliyuncs.com\/v2\/google_containers\"\n  gcr.io:\n    endpoint:\n      - \"https:\/\/gcr.m.daocloud.io\/\"\n  k8s.gcr.io:\n    endpoint:\n      - \"https:\/\/registry.aliyuncs.com\/google_containers\"\n  ghcr.io:\n    endpoint:\n      - \"https:\/\/ghcr.m.daocloud.io\/\"<\/code><\/pre>\n\n\n\n<p>docker \u5982\u679c\u662f snap \u5b89\u88c5\uff0c\u6587\u4ef6: \/var\/snap\/docker\/current\/config\/daemon.json \uff0c\u5982\u679c\u662f apt \u6216\u8005 yum \u5b89\u88c5\uff0c\u6587\u4ef6: \/etc\/docker\/daemon.json<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"log-level\":        \"error\", \/\/ \u53ef\u9009\n    \"registry-mirrors\": &#091;\n        \"https:\/\/docker.1panel.live\",\n        \"https:\/\/docker.m.daocloud.io\",\n        \"https:\/\/registry.cn-beijing.aliyuncs.com\"\n    ]\n}<\/code><\/pre>\n\n\n\n<p>3. \u91cd\u542f docker \u670d\u52a1\u3002snap\u5b89\u88c5\uff0csnap restart docker\u3002apt\u6216\u8005yum\u5b89\u88c5\uff0csystemctl restart docker  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u5b89\u88c5 \u589e\u52a0 node \u65f6\u53ef\u4ee5 \u67e5\u770btoken 2. \u8bbe\u7f6e docker \u7684\u56fd\u5185\u955c\u50cf k3s \u6587\u4ef6\uff1a\/etc\/rancher\/k3s\/registries.yaml docker \u5982\u679c\u662f snap \u5b89\u88c5\uff0c\u6587\u4ef6: \/var\/snap\/docker\/current\/config\/daemon.json \uff0c\u5982\u679c\u662f apt \u6216\u8005 yum \u5b89\u88c5\uff0c\u6587\u4ef6: \/etc\/docker\/daemon.json 3.\u2026<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[12,22],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=\/wp\/v2\/posts\/593"}],"collection":[{"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=593"}],"version-history":[{"count":5,"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=\/wp\/v2\/posts\/593\/revisions"}],"predecessor-version":[{"id":598,"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=\/wp\/v2\/posts\/593\/revisions\/598"}],"wp:attachment":[{"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.doublejia.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}