{"id":830,"date":"2022-09-21T15:46:00","date_gmt":"2022-09-21T07:46:00","guid":{"rendered":"http:\/\/www.langmanezhuang.com\/index.php\/2022\/09\/21\/%e3%80%90%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e3%80%91k3s%e9%83%a8%e7%bd%b2redis\/"},"modified":"2022-11-26T20:54:33","modified_gmt":"2022-11-26T12:54:33","slug":"%e3%80%90%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e3%80%91k3s%e9%83%a8%e7%bd%b2redis","status":"publish","type":"post","link":"http:\/\/blog.langmanezhuang.com\/index.php\/2022\/09\/21\/%e3%80%90%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e3%80%91k3s%e9%83%a8%e7%bd%b2redis\/","title":{"rendered":"\u3010\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668\u3011k3s\u90e8\u7f72redis"},"content":{"rendered":"<p>1.\u5728\u8f7b\u5e94\u7528\u670d\u52a1\u5668\u4e2d\u5b89\u88c5\u597dK3s<\/p>\n<p>2.\u767b\u5f55k3s\u53catoken<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/13-543925-20220917164838266-773108133.png\" alt=\"\" width=\"985\" height=\"404\" class=\"medium-zoom-image\" loading=\"lazy\" \/>&nbsp;<\/p>\n<p>3.\u767b\u5f55\u4e0ak3s\uff0c\u5982\u4e0b\u56fe<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/14-543925-20220917164624378-1191114952.png\" alt=\"\" width=\"985\" height=\"481\" class=\"medium-zoom-image\" loading=\"lazy\" \/><\/p>\n<p>4.\u6309\u7167\u56fe\u4e0b\u56fe\u64cd\u4f5c\uff0c\u6253\u5f00\u90e8\u7f72\u754c\u9762<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/15-543925-20220917165059222-404891716.png\" alt=\"\" width=\"991\" height=\"484\" class=\"medium-zoom-image\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>5.\u90e8\u7f72redis\uff0c\u90e8\u7f72\u7528\u7684yaml\u5982\u4e0b<\/p>\n<div class=\"cnblogs_code\">\n<pre><span style=\"color: #000000;\">apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: redis-deployment\n  labels:\n    app: redis\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: redis\n  template:\n    metadata:\n      labels:\n        app: redis\n    spec:\n      containers:\n      - name: redis\n        image: redis:bullseye\n        command:\n        - redis-server\n        - \"\/redis\/redis.conf\/redis.conf\"\n        ports:\n        - containerPort: 6379\n        volumeMounts:\n        - name: redis-data\n          mountPath: \/data\n        - name: redis-config\n          mountPath: \/redis\/redis.conf\n      volumes:\n        - name: redis-data\n          hostPath:\n            path: \/root\/data\/redis\n            type: Directory\n        - name: redis-config\n          hostPath:\n            path: \/root\/data\/redis-config\n            type: Directory<\/span><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>\u6ce8\u610f\uff1a1.\u5176\u4e2dredis<em>-config<\/em>\u6302\u8f7d\uff0c\u662f\u4e3a\u4e86\u81ea\u5b9a\u4e49redis\u542f\u52a8\u914d\u7f6e\u3002<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;redis-data\u662fredis\u7684\u6570\u636e\u6587\u4ef6\uff0c\u6302\u8f7d\u51fa\u6765\u53ef\u4ee5\u6301\u4e45\u5316\uff0c\u907f\u514d\u6570\u636e\u6587\u4ef6\u4e22\u5931\u3002<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2.\u8def\u5f84\u8bf4\u660e\u5982\u4e0b\u56fe<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/27-543925-20220921230620046-1189704322.png\" alt=\"\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;3.myql\u7684dockerhub\u955c\u50cf\u5730\u5740<\/p>\n<div class=\"cnblogs_code\">\n<pre>image: redis:bullseye<\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;\u7f16\u8f91\u5b8c\u6210\u540e\uff0c\u70b9\u51fb&lsquo;Upload&rsquo;\u5373\u53ef\u90e8\u7f72\u6210\u529f\u3002<\/p>\n<div class=\"cnblogs_Highlighter\"><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/28-543925-20220917165458226-793049507.png\" alt=\"\" width=\"988\" height=\"483\" class=\"medium-zoom-image\" loading=\"lazy\" \/>&nbsp;<\/div>\n<p>&nbsp;\u6b64\u65f6\uff0c\u65e0\u6cd5\u901a\u8fc7\u5916\u7f51\u548c\u670d\u52a1\u95f4\u65e0\u6cd5\u8c03\u7528\uff0c\u9700\u8981\u90e8\u7f72service\u6765\u5b9e\u73b0\uff0c\u90e8\u7f72yaml\u5982\u4e0b<\/p>\n<div class=\"cnblogs_code\">\n<pre><span style=\"color: #000000;\">apiVersion: v1\nkind: Service\nmetadata:\n  name: redis-service\nspec:\n  type: NodePort\n  selector:\n    app: redis\n  ports:\n  - protocol: TCP\n    port: 6379\n    targetPort: 6379\n    nodePort: 30001<\/span><\/pre>\n<\/div>\n<p>&nbsp;<\/p>\n<p><span style=\"background-color: #ffffff; font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 14px;\">&nbsp;<\/span><\/p>\n<p>\u6ce8\u610f\uff1a<em id=\"__mceDel\">\u901a\u8fc7NodePort\u65b9\u5f0f\uff0c\u5c06\u670d\u52a1\u5f00\u542f\u5728\u4e8630000\u7aef\u53e3\u3002<\/em><\/p>\n<p><em>&nbsp; &nbsp;&nbsp;<img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/29-543925-20220921234300255-173062677.png\" alt=\"\" loading=\"lazy\" \/><\/em><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>\u7f16\u8f91\u5b8c\u6210\u540e\uff0c\u70b9\u51fb&lsquo;Upload&rsquo;\u5373\u53ef\u90e8\u7f72service\u6210\u529f\u3002<\/p>\n<p><em><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/30-543925-20220921234340922-394205140.png\" alt=\"\" width=\"945\" height=\"376\" loading=\"lazy\" \/><\/em><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;\u6b64\u65f6\uff0c\u5728\u8be5\u5e94\u7528\u7684\u9632\u706b\u5899\u91cc\u6dfb\u52a0\u30103001\u3011\u7aef\u53e3\uff0c\u5373\u53ef\u5916\u7f51\u6b63\u5e38\u8bbf\u95eeredis\u4e86<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/cdn.langmanezhuang.com\/blog\/20221126\/31-543925-20220921234508712-1159340496.png\" alt=\"\" width=\"935\" height=\"457\" loading=\"lazy\" \/><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1.\u5728\u8f7b\u5e94\u7528\u670d\u52a1\u5668\u4e2d\u5b89\u88c5\u597dK3s 2.\u767b\u5f55k3s\u53catoken &nbsp; 3.\u767b\u5f55\u4e0ak3s\uff0c\u5982\u4e0b\u56fe 4.\u6309\u7167 &hellip; <a href=\"http:\/\/blog.langmanezhuang.com\/index.php\/2022\/09\/21\/%e3%80%90%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8%e6%9c%8d%e5%8a%a1%e5%99%a8%e3%80%91k3s%e9%83%a8%e7%bd%b2redis\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb <span class=\"screen-reader-text\">\u3010\u8f7b\u91cf\u5e94\u7528\u670d\u52a1\u5668\u3011k3s\u90e8\u7f72redis<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6,1],"tags":[7,9],"_links":{"self":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/830"}],"collection":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/comments?post=830"}],"version-history":[{"count":1,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/830\/revisions"}],"predecessor-version":[{"id":959,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/posts\/830\/revisions\/959"}],"wp:attachment":[{"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/media?parent=830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/categories?post=830"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.langmanezhuang.com\/index.php\/wp-json\/wp\/v2\/tags?post=830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}