{"id":10049,"date":"2023-03-22T11:00:46","date_gmt":"2023-03-22T03:00:46","guid":{"rendered":"http:\/\/123.57.164.21\/?p=10049"},"modified":"2023-03-24T22:28:25","modified_gmt":"2023-03-24T14:28:25","slug":"hands-on-lab-%e4%bd%bf%e7%94%a8helm%e9%83%a8%e7%bd%b2openshift%e5%ba%94%e7%94%a8","status":"publish","type":"post","link":"https:\/\/92it.top\/?p=10049","title":{"rendered":"Hands-on Lab &#8211; \u4f7f\u7528Helm\u90e8\u7f72OpenShift\u5e94\u7528"},"content":{"rendered":"\n<p><strong>\u524d\u8a00<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>Helm \u662f Kubernetes \u7684\u5305\u7ba1\u7406\u5668\u3002\u5305\u7ba1\u7406\u5668\u7c7b\u4f3c\u4e8e\u6211\u4eec\u5728 Ubuntu \u4e2d\u4f7f\u7528\u7684apt\u3001Centos\u4e2d\u4f7f\u7528\u7684yum \u6216\u8005Python\u4e2d\u7684 pip \u4e00\u6837\uff0c\u80fd\u5feb\u901f\u67e5\u627e\u3001\u4e0b\u8f7d\u548c\u5b89\u88c5\u8f6f\u4ef6\u5305\u3002Helm \u7531\u5ba2\u6237\u7aef\u7ec4\u4ef6 helm \u548c\u670d\u52a1\u7aef\u7ec4\u4ef6 Tiller \u7ec4\u6210, \u80fd\u591f\u5c06\u4e00\u7ec4K8S\u8d44\u6e90\u6253\u5305\u7edf\u4e00\u7ba1\u7406, \u662f\u67e5\u627e\u3001\u5171\u4eab\u548c\u4f7f\u7528\u4e3aKubernetes\u6784\u5efa\u7684\u8f6f\u4ef6\u7684\u6700\u4f73\u65b9\u5f0f\u3002<br><\/p>\n\n\n\n<p><strong>\u89e3\u51b3\u95ee\u9898<\/strong><\/p>\n\n\n\n<p>\u80fd\u5bf9\u591a\u4e2a\u6a21\u677f\u6587\u4ef6\uff08yaml\u6587\u4ef6\uff09\u8fdb\u884c\u7edf\u4e00\u7ba1\u7406\uff0c\u8bbe\u60f3\u4e00\u4e0b\uff0c\u5982\u679c\u6ca1\u6709helm\uff0c\u5982\u4f55\u6267\u884c\u591a\u4e2a\u6a21\u677f\u6587\u4ef6\u5462\uff1f\u90a3\u5c31\u5f97\u4e00\u4e2a\u4e2a\u7684\u6267\u884ckubectl apply -f xxx.yaml\u3002\u800c\u5982\u4eca\u6709\u4e86helm\uff0c\u53ea\u9700\u8981\u5c06\u6587\u4ef6\u653e\u5165chart\u5305\u4e2d\uff0c\u7136\u540e\u4e00\u53e5helm install xxx path\u4fbf\u53ef\u4ee5\u6267\u884c\u6240\u6709\u7684\u6a21\u677f\u6587\u4ef6\u3002\u5f53\u7136helm\u7684\u597d\u5904\u4e0d\u4ec5\u4e8e\u6b64\uff0c\u8fd8\u6709\u5176\u4ed6\u4fbf\u5229\u4e4b\u5904\uff0c\u6709\u5f85\u5927\u5bb6\u6316\u6398\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">   \/\/\u521b\u5efa\u4e00\u4e2achart\u5305\u6a21\u677f\n   helm create xxx(chart\u5305\u540d)\n\n   \/\/\u5b89\u88c5\n   helm install xxx -n namespace\n\n   \/\/\u5378\u8f7d\n   helm uninstall xxx -n namespace\n\n   \/\/\u9884\u586b\u5145\u53d8\u91cf\/\u53c2\u6570\n   helm install xxx -n namespace --dry-run\n<\/pre>\n\n\n\n<p><strong>chart\u5305\u7ed3\u6784<\/strong><\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-297-1024x649.png\" alt=\"\" class=\"wp-image-10217\" width=\"472\" height=\"299\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297-1024x649.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297-300x190.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297-768x487.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297-830x526.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297-230x146.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297-350x222.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297-480x304.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-297.png 1224w\" sizes=\"(max-width: 472px) 100vw, 472px\" \/><\/figure><\/div>\n\n\n\n<p><br><\/p>\n\n\n\n<p><strong>\u67b6\u6784\u4ecb\u7ecd<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><strong>\u7ec4\u4ef6<\/strong><\/p>\n\n\n\n<p>Helm \u5305\u542b\u4e24\u4e2a\u7ec4\u4ef6\uff0c\u5206\u522b\u662f helm \u5ba2\u6237\u7aef \u548c Tiller \u670d\u52a1\u5668\uff1a<\/p>\n\n\n\n<ul><li>helm \u662f\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u7528\u4e8e\u672c\u5730\u5f00\u53d1\u53ca\u7ba1\u7406chart\uff0cchart\u4ed3\u5e93\u7ba1\u7406\u7b49<\/li><li>Tiller \u662f Helm \u7684\u670d\u52a1\u7aef\u3002Tiller \u8d1f\u8d23\u63a5\u6536 Helm \u7684\u8bf7\u6c42\uff0c\u4e0e k8s \u7684 apiserver \u4ea4\u4e92\uff0c\u6839\u636echart \u6765\u751f\u6210\u4e00\u4e2a release \u5e76\u7ba1\u7406 release\uff0cTiller \u662f\u548ck8s\u6c9f\u901a\u7684\u7ec4\u4ef6\uff0chelm\u662f\u5ba2\u6237\u7aef\u547d\u4ee4\uff0cTiller\u662f\u670d\u52a1\u5668\u7aef\u7a0b\u5e8f\uff0chelm\u53d1\u9001\u547d\u4ee4\u5230Tiller\uff0c\u7136\u540eTiller\u64cd\u4f5ck8s\u5b8c\u6210\u4efb\u52a1\u3002<\/li><li>chart Helm\u7684\u6253\u5305\u683c\u5f0f\u53eb\u505achart\uff0c\u6240\u8c13chart\u5c31\u662f\u4e00\u7cfb\u5217\u6587\u4ef6, \u5b83\u63cf\u8ff0\u4e86\u4e00\u7ec4\u76f8\u5173\u7684 k8s \u96c6\u7fa4\u8d44\u6e90<\/li><li>release \u4f7f\u7528 helm install \u547d\u4ee4\u5728 Kubernetes \u96c6\u7fa4\u4e2d\u90e8\u7f72\u7684 Chart \u79f0\u4e3a Release<\/li><li>Repoistory Helm chart \u7684\u4ed3\u5e93\uff0cHelm \u5ba2\u6237\u7aef\u901a\u8fc7 HTTP \u534f\u8bae\u6765\u8bbf\u95ee\u5b58\u50a8\u5e93\u4e2d chart \u7684\u7d22\u5f15\u6587\u4ef6\u548c\u538b\u7f29\u5305<\/li><\/ul>\n\n\n\n<p><strong>\u539f\u7406<\/strong><\/p>\n\n\n\n<p>\u4e0b\u9762\u56fe\u63cf\u8ff0\u4e86 Helm \u7684\u51e0\u4e2a\u5173\u952e\u7ec4\u4ef6 Helm\uff08\u5ba2\u6237\u7aef\uff09\u3001Tiller\uff08\u670d\u52a1\u5668\uff09\u3001Repository\uff08Chart \u8f6f\u4ef6\u4ed3\u5e93\uff09\u3001Chart\uff08\u8f6f\u4ef6\u5305\uff09\u4e4b\u95f4\u7684\u5173\u7cfb\u4ee5\u53ca\u5b83\u4eec\u4e4b\u95f4\u5982\u4f55\u901a\u4fe1 \uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-298-1024x399.png\" alt=\"\" class=\"wp-image-10218\" width=\"426\" height=\"166\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298-1024x399.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298-300x117.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298-768x299.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298-830x324.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298-230x90.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298-350x136.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298-480x187.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-298.png 1272w\" sizes=\"(max-width: 426px) 100vw, 426px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u521b\u5efarelease<\/strong><\/p>\n\n\n\n<ul><li>helm \u5ba2\u6237\u7aef\u4ece\u6307\u5b9a\u7684\u76ee\u5f55\u6216\u672c\u5730tar\u6587\u4ef6\u6216\u8fdc\u7a0brepo\u4ed3\u5e93\u89e3\u6790\u51fachart\u7684\u7ed3\u6784\u4fe1\u606f<\/li><li>helm \u5ba2\u6237\u7aef\u6307\u5b9a\u7684 chart \u7ed3\u6784\u548c values \u4fe1\u606f\u901a\u8fc7 gRPC \u4f20\u9012\u7ed9 Tiller<\/li><li>Tiller \u670d\u52a1\u7aef\u6839\u636e chart \u548c values \u751f\u6210\u4e00\u4e2a release<\/li><li>Tiller \u5c06install release\u8bf7\u6c42\u76f4\u63a5\u4f20\u9012\u7ed9 kube-apiserver<\/li><\/ul>\n\n\n\n<p><strong>\u5220\u9664release<\/strong><\/p>\n\n\n\n<ul><li>helm \u5ba2\u6237\u7aef\u4ece\u6307\u5b9a\u7684\u76ee\u5f55\u6216\u672c\u5730tar\u6587\u4ef6\u6216\u8fdc\u7a0brepo\u4ed3\u5e93\u89e3\u6790\u51fachart\u7684\u7ed3\u6784\u4fe1\u606f<\/li><li>helm \u5ba2\u6237\u7aef\u6307\u5b9a\u7684 chart \u7ed3\u6784\u548c values \u4fe1\u606f\u901a\u8fc7 gRPC \u4f20\u9012\u7ed9 Tiller<\/li><li>Tiller \u670d\u52a1\u7aef\u6839\u636e chart \u548c values \u751f\u6210\u4e00\u4e2a release<\/li><li>Tiller \u5c06delete release\u8bf7\u6c42\u76f4\u63a5\u4f20\u9012\u7ed9 kube-apiserver<\/li><\/ul>\n\n\n\n<p><strong>\u66f4\u65b0release<\/strong><\/p>\n\n\n\n<ul><li>helm \u5ba2\u6237\u7aef\u5c06\u9700\u8981\u66f4\u65b0\u7684 chart \u7684 release \u540d\u79f0 chart \u7ed3\u6784\u548c value \u4fe1\u606f\u4f20\u7ed9 Tiller<\/li><li>Tiller \u5c06\u6536\u5230\u7684\u4fe1\u606f\u751f\u6210\u65b0\u7684 release\uff0c\u5e76\u540c\u65f6\u66f4\u65b0\u8fd9\u4e2a release \u7684 history<\/li><li>Tiller \u5c06\u65b0\u7684 release \u4f20\u9012\u7ed9 kube-apiserver \u8fdb\u884c\u66f4\u65b0<\/li><\/ul>\n\n\n\n<p><strong>Helm\u67b6\u6784\u53ca\u5176\u7ec4\u4ef6<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>\u5728OpenShift 4\u4e2d\u5185\u7f6e\u4e86Helm 3\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Helm Chart\u90e8\u7f72OpenShift\u5e94\u7528\u3002Helm\u4f7f\u7528Chart\u8bb0\u5f55\u8981\u90e8\u7f72\u8d44\u6e90\u7684\u914d\u7f6e\uff0c\u8fd9\u975e\u5e38\u7c7b\u4f3cOpenShift\u81ea\u5e26\u7684Template\uff1a<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-186-1024x292.png\" alt=\"\" class=\"wp-image-10050\" width=\"526\" height=\"149\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186-1024x292.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186-300x86.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186-768x219.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186-830x237.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186-230x66.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186-350x100.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186-480x137.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-186.png 1282w\" sizes=\"(max-width: 526px) 100vw, 526px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u4e0b\u8f7dhelm\u5ba2\u6237\u7aef<\/strong><\/p>\n\n\n\n<p>\u4e0b\u8f7dhelm\u5ba2\u6237\u7aef\uff0c\u5e76\u67e5\u770b\u7248\u672c\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ sudo curl -L https:\/\/mirror.openshift.com\/pub\/openshift-v4\/clients\/helm\/latest\/helm-linux-amd64 -o \/usr\/local\/bin\/helm\n$ sudo chmod +x \/usr\/local\/bin\/helm\n$ helm version\nversion.BuildInfo{Version:\"v3.6.2+5.el8\", GitCommit:\"eb607dd4f123eaedab662cef21008d177f2c3426\", GitTreeState:\"clean\", GoVersion:\"go1.15.13\"}\n<\/pre>\n\n\n\n<p><strong>\u5728\u63a7\u5236\u53f0\u7528Helm Chart\u5b89\u88c5\u90e8\u7f72\u5e94\u7528<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>1.\u521b\u5efa\u9879\u76ee<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ oc new-project helm-nodejs<\/pre>\n\n\n\n<p>2.\u8fdb\u5165OpenShift\u63a7\u5236\u53f0\u7684\u201c<strong>\u5f00\u53d1\u8005<\/strong>\u201d\u89c6\u56fe\uff0c\u70b9\u51fb\u201c<strong>+\u6dfb\u52a0<\/strong>\u201d\u83dc\u5355\uff0c\u7136\u540e\u627e\u5230\u201c<strong>Helm Chart<\/strong>\u201d\u8fdb\u5165\u3002<\/p>\n\n\n\n<p>3.\u901a\u8fc7\u5728\u201cLanguages\u201d\u4e2d\u67e5\u627e\u201c<strong>nodejs<\/strong>\u201d\uff0c\u627e\u5230\u4e0b\u9762\u7684Helm Chart\uff0c\u7136\u540e\u70b9\u51fb\u8fdb\u5165\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-187-1024x900.png\" alt=\"\" class=\"wp-image-10051\" width=\"416\" height=\"366\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187-1024x900.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187-300x264.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187-768x675.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187-830x730.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187-230x202.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187-350x308.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187-480x422.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-187.png 1472w\" sizes=\"(max-width: 416px) 100vw, 416px\" \/><\/figure><\/div>\n\n\n\n<p>4.\u5728\u53f3\u6ed1\u7684\u5b89\u88c5\u754c\u9762\u4e2d\u70b9\u51fb\u201c<strong>\u5b89\u88c5Helm Chart<\/strong>\u201d\u6309\u94ae\uff0c\u7136\u540e\u5728\u201c\u5b89<strong>\u88c5Helm Chart<\/strong>\u201d\u9875\u9762\u4e2d\u63a5\u53d7\u7f3a\u7701\u914d\u7f6e\uff0c\u6700\u540e\u70b9\u51fb\u201c<strong>\u5b89\u88c5<\/strong>\u201d\u6309\u94ae\uff0c\u6b64\u65f6\u9875\u9762\u5c06\u8df3\u8f6c\u5230\u201c<strong>\u62d3\u6251<\/strong>\u201d\u3002<\/p>\n\n\n\n<p>5.\u6b64\u65f6OpenShift\u4f1a\u6839\u636e\u8fd9\u4e2aHelm Chart\u62c9\u53d6Nodejs\u5e94\u7528\u4ee3\u7801\uff0c\u7136\u540e\u901a\u8fc7Build\u6784\u5efa\u5e94\u7528\u955c\u50cf\uff0c\u6700\u540e\u518d\u90e8\u7f72\u8fd0\u884c\u3002<\/p>\n\n\n\n<p>6.\u90e8\u7f72\u5b8c\u6210\u540e\u5982\u4e0b\u56fe\uff0c\u6b64\u65f6\u53ef\u901a\u8fc7Route\u8bbf\u95ee\u90e8\u7f72\u597d\u7684\u5e94\u7528\u4e86\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-188-1024x661.png\" alt=\"\" class=\"wp-image-10052\" width=\"511\" height=\"330\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188-1024x661.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188-300x194.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188-768x496.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188-830x536.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188-230x149.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188-350x226.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188-480x310.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-188.png 1524w\" sizes=\"(max-width: 511px) 100vw, 511px\" \/><\/figure><\/div>\n\n\n\n<p>7.\u8fdb\u5165\u201c<strong>Helm<\/strong>\u201d\u83dc\u5355\uff0c\u5728\u5217\u8868\u4e2d\u8fdb\u5165\u201c<strong>nodejs<\/strong>\u201d\uff0c\u53ef\u5728\u201c<strong>\u8d44\u6e90<\/strong>\u201d\u4e2d\u67e5\u770b\u6240\u6709\u901a\u8fc7Helm Chart\u521b\u5efa\u7684OpenShift\u8d44\u6e90\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-189-1024x447.png\" alt=\"\" class=\"wp-image-10053\" width=\"606\" height=\"264\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189-1024x447.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189-300x131.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189-768x336.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189-830x363.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189-230x100.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189-350x153.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189-480x210.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-189.png 1506w\" sizes=\"(max-width: 606px) 100vw, 606px\" \/><\/figure><\/div>\n\n\n\n<p><strong>\u901a\u8fc7\u5916\u90e8Helm Repo\u5b89\u88c5\u90e8\u7f72\u5e94\u7528<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>1.\u521b\u5efa\u9879\u76ee\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ oc new-project helm-nginx<\/pre>\n\n\n\n<p>2.\u6267\u884c\u547d\u4ee4\uff0c\u67e5\u770b\u5305\u542bnginx\u7684helm hub\u7684Repo\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm search hub nginx\nURL                                                     CHART VERSION   APP VERSION             DESCRIPTION\nhttps:\/\/artifacthub.io\/packages\/helm\/test-nginx...      0.1.0           1.16.0                  A Helm chart for Kubernetes\nhttps:\/\/artifacthub.io\/packages\/helm\/shubhamtat...      0.1.12          1.19.6                  Nginx Helm chart for Kubernetes\nhttps:\/\/artifacthub.io\/packages\/helm\/dysnix\/nginx       7.1.8           1.19.4                  Chart for the nginx server\nhttps:\/\/artifacthub.io\/packages\/helm\/mirantis\/n...      0.1.0           1.16.0                  A NGINX Docker Community based Helm chart for K...\nhttps:\/\/artifacthub.io\/packages\/helm\/bitnami\/nginx      9.4.2           1.21.1                  Chart for the nginx server\nhttps:\/\/artifacthub.io\/packages\/helm\/bitnami-ak...      9.4.2           1.21.1                  Chart for the nginx server\nhttps:\/\/artifacthub.io\/packages\/helm\/krakazyabr...      1.0.0           1.19.0                  Nginx Helm chart for Kubernetes\nhttps:\/\/artifacthub.io\/packages\/helm\/wiremind\/n...      2.1.1                                   An NGINX HTTP server\nhttps:\/\/artifacthub.io\/packages\/helm\/t3n\/nginx          0.1.1                                   Simple nginx deployment usable for deploying pr...\nhttps:\/\/artifacthub.io\/packages\/helm\/slamdev\/nginx      0.0.17          1.19.10                 Helm chart to deploy [nginx](https:\/\/www.nginx....\nhttps:\/\/artifacthub.io\/packages\/helm\/cocainefar...      1.0.1           latest                  A chart to do nginx things\nhttps:\/\/artifacthub.io\/packages\/helm\/douban\/nginx       0.1.2           0.16.0                  A Helm chart for Kubernetes\nhttps:\/\/artifacthub.io\/packages\/helm\/ingress-ng...      4.0.0           1.0.0-beta.1            Ingress controller for Kubernetes using NGINX a...\nhttps:\/\/artifacthub.io\/packages\/helm\/nginx-edge...      0.0.0-edge      1.12.0                  NGINX Ingress Controller\nhttps:\/\/artifacthub.io\/packages\/helm\/nginx\/ngin...      0.10.0          1.12.0                  NGINX Ingress Controller\nhttps:\/\/artifacthub.io\/packages\/helm\/okteto\/ngi...      1.41.2          v0.34.1                 An nginx Ingress controller that uses ConfigMap...\nhttps:\/\/artifacthub.io\/packages\/helm\/hkube\/ngin...      1.31.1002       0.29.0                  An nginx Ingress controller that uses ConfigMap...\nhttps:\/\/artifacthub.io\/packages\/helm\/wenerme\/in...      4.0.0           1.0.0-beta.1            Ingress controller for Kubernetes using NGINX a...\nhttps:\/\/artifacthub.io\/packages\/helm\/api\/ingres...      3.29.1          0.45.0                  Ingress controller for Kubernetes using NGINX a...\nhttps:\/\/artifacthub.io\/packages\/helm\/ngrok-ingr...      0.3.0           1.16.0                  Nginx example demonstrates usage of a helm char...\nhttps:\/\/artifacthub.io\/packages\/helm\/nexclipper...      0.1.3           0.1.3                   A Helm chart for the Prometheus NGINX Exporter\nhttps:\/\/artifacthub.io\/packages\/helm\/drpsychick...      0.0.2           8-fpm-alpine            A chart for an nginx pod with multiple phpfpm pods\nhttps:\/\/artifacthub.io\/packages\/helm\/ygqygq2\/ng...      1.1.0           1.14.2                  Chart for the nginx server\nhttps:\/\/artifacthub.io\/packages\/helm\/bitnami-ak...      5.2.4           1.17.10                 Chart for the nginx server\nhttps:\/\/artifacthub.io\/packages\/helm\/ygqygq2\/fa...      1.0.2           V5.11                   FastDFS-Nginx chart for Kubernetes\nhttps:\/\/artifacthub.io\/packages\/helm\/cloudposse...      0.1.8                                   A Helm chart for Nginx Ingress\nhttps:\/\/artifacthub.io\/packages\/helm\/psu-swe\/ng...      0.2.0           1.16.1                  An nginx chart built to simply provide redirect...\nhttps:\/\/artifacthub.io\/packages\/helm\/cocainefar...      0.7.0           latest                  A Dockerfile for nginx-rtmp-module + FFmpeg fro...\nhttps:\/\/artifacthub.io\/packages\/helm\/newrelic\/s...      1.1.1           1.1                     A Helm chart for installing a simple nginx\nhttps:\/\/artifacthub.io\/packages\/helm\/cloudposse...      0.5.0                                   A Helm chart for nginx-default-backend to be us...\nhttps:\/\/artifacthub.io\/packages\/helm\/microfunct...      7.5.0           0.44.0                  Chart for the nginx Ingress controller\nhttps:\/\/artifacthub.io\/packages\/helm\/bitnami\/ng...      7.6.18          0.48.1                  Chart for the nginx Ingress controller\n\u3002\u3002\u3002\n<\/pre>\n\n\n\n<p>3.\u7528\u6d4f\u89c8\u5668\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684https:\/\/artifacthub.io\/packages\/helm\/bitnami\/nginx<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-190-1024x641.png\" alt=\"\" class=\"wp-image-10055\" width=\"541\" height=\"338\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190-1024x641.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190-300x188.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190-768x481.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190-830x519.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190-230x144.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190-350x219.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190-480x300.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-190.png 1502w\" sizes=\"(max-width: 541px) 100vw, 541px\" \/><\/figure><\/div>\n\n\n\n<p>4.\u6267\u884c\u547d\u4ee4\uff0c\u5c06\u4e0a\u56fe\u7684https:\/\/charts.bitnami.com\/bitnami\u52a0\u5165\u5230\u5f53\u524dhelm\u7684repo\u4e2d\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami\n\"bitnami\" has been added to your repositories<\/pre>\n\n\n\n<p>5.\u67e5\u770b\u672c\u5730Helm Repo\u5217\u8868\uff0c\u786e\u8ba4\u6709\u540d\u4e3abitnami\u7684Repo\uff0c\u5e76\u4e14\u5176\u4e2d\u5305\u542bnginx\u7684Chart\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm repo list\nNAME    URL\nbitnami https:\/\/charts.bitnami.com\/bitnami\n$ helm search repo bitnami\/nginx\nNAME                                    CHART VERSION   APP VERSION     DESCRIPTION\nbitnami\/nginx                           9.4.2           1.21.1          Chart for the nginx server\nbitnami\/nginx-ingress-controller        7.6.18          0.48.1          Chart for the nginx Ingress controller\n<\/pre>\n\n\n\n<p>6.\u6839\u636ebitnami\/nginx\u7684Chart\u521b\u5efa\u5e94\u7528\u8d44\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm install my-nginx bitnami\/nginx --set service.type=ClusterIP\nNAME: my-nginx\nLAST DEPLOYED: Thu Dec 24 13:03:47 2020\nNAMESPACE: helm-nginx\nSTATUS: deployed\nREVISION: 1\nTEST SUITE: None\nNOTES:\n** Please be patient while the chart is being deployed **\n \nNGINX can be accessed through the following DNS name from within your cluster:\n \n    my-nginx.helm-nginx.svc.cluster.local (port 80)\n \nTo access NGINX from outside the cluster, follow the steps below:\n \n1. Get the NGINX URL by running these commands:\n \n    export SERVICE_PORT=$(kubectl get --namespace helm-nginx -o jsonpath=\"{.spec.ports[0].port}\" services my-nginx)\n    kubectl port-forward --namespace helm svc\/my-nginx ${SERVICE_PORT}:${SERVICE_PORT} &amp;\n    echo \"http:\/\/127.0.0.1:${SERVICE_PORT}\"\n<\/pre>\n\n\n\n<p>7.\u6267\u884c\u547d\u4ee4\uff0c\u67e5\u770b\u5f53\u524dproject\u4e2d\u901a\u8fc7helm\u90e8\u7f72\u7684Chart\uff0c\u786e\u8ba4\u6709\u540d\u4e3amy-ngin\u7684Chart\u8d44\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm ls\nNAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART           APP VERSION\nmy-nginx        helm-nginx      1               2020-12-24 13:03:47.342110531 +0000 UTC deployed        nginx-9.4.2     1.21.1\n<\/pre>\n\n\n\n<p>8.\u786e\u8ba4\u6b64\u65f6Deployment\u3001Pod\u3001Service\u7b49\u8d44\u6e90\u5df2\u7ecf\u90e8\u7f72\u597d\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ oc get deployment -n helm-nginx\nNAME       READY   UP-TO-DATE   AVAILABLE   AGE\nmy-nginx   1\/1     1            1           33m\n$ oc get pods -n helm-nginx\nNAME                       READY   STATUS      RESTARTS   AGE\nmy-nginx-f5c84bc49-dnp7b   1\/1     Running     0          21m$ \n$ oc get services -n helm-nginx\nNAME           TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE\nmy-nginx       ClusterIP   172.30.134.59    &lt;none>        80\/TCP,443\/TCP   22m\n<\/pre>\n\n\n\n<p>9.\u6839\u636eService\u751f\u6210Route\uff0c\u7136\u540e\u7528\u6d4f\u89c8\u5668\u8bbf\u95eeRoute\u5730\u5740\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ oc expose svc\/my-nginx -n helm-nginx\nroute.route.openshift.io\/my-nginx exposed\n$ oc get routes -n helm-nginx\nNAME       HOST\/PORT                                                                   PATH   SERVICES   PORT   TERMINATION   WILDCARD\nmy-nginx   my-nginx-helm-nginx.apps.cluster-pek-99bc.pek-99bc.sandbox309.opentlc.com          my-nginx   http                 None\n<\/pre>\n\n\n\n<p>10.\u5220\u9664my-nginx\u7684Chart\u5305\u62ec\u7684\u76f8\u5173\u8d44\u6e90\u4ee5\u53caRoute\u8d44\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm uninstall my-nginx\nrelease \"my-nginx\" uninstalled\n$ oc delete route my-nginx -n helm-nginx\n$ oc get all -n helm-nginx\nNo resources found in helm-nginx namespace.\n<\/pre>\n\n\n\n<p><strong>\u4f7f\u7528\u672c\u5730Helm Repo\u5b89\u88c5\u90e8\u7f72\u5e94\u7528<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>1.\u521b\u5efa\u65b0\u9879\u76ee<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ oc new-project helm-mysql<\/pre>\n\n\n\n<p>2.\u4e0b\u8f7d\u9879\u76eeRepo\u5230\u672c\u5730<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ git clone https:\/\/github.com\/liuxiaoyu-git\/helm-repo\nCloning into 'helm-repo'...\nremote: Enumerating objects: 39, done.\nremote: Total 39 (delta 0), reused 0 (delta 0), pack-reused 39\nUnpacking objects: 100% (39\/39), done.\n<\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-191-1024x475.png\" alt=\"\" class=\"wp-image-10056\" width=\"471\" height=\"218\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-1024x475.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-300x139.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-768x357.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-1536x713.png 1536w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-830x385.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-230x107.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-350x163.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191-480x223.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-191.png 2046w\" sizes=\"(max-width: 471px) 100vw, 471px\" \/><\/figure><\/div>\n\n\n\n<p>3.\u6839\u636e\u672c\u5730Repo\u5b89\u88c5mysql\u5e94\u7528<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm install mysql .\/helm-repo\/incubator\/mysql\nNAME: mysql                                                                                                                                      \nLAST DEPLOYED: Mon Mar  2 07:02:53 2020                                                                                                          \nNAMESPACE: helm-mysql                                                                                                                           \nSTATUS: deployed                                                                                                                                 \nREVISION: 1                                                                                                                                      \nTEST SUITE: None                                                                                                                                 \nNOTES:                                                                                                                                           \nMySQL can be accessed via port 3306 on the following DNS name from within your cluster:                                                          \nmysql-mysql.helm-mysql.svc.cluster.local                                                                                                        \n                                                                                                                                                 \nTo get your root password run:                                                                                                                   \n                                                                                                                                                 \n    MYSQL_ROOT_PASSWORD=$(oc get secret --namespace helm-mysql mysql-mysql -o jsonpath=\"{.data.database-root-password}\" | base64 --decode; echo)\n                                                                                                                                                 \nTo know your database:                                                                                                                           \n                                                                                                                                                 \n    MYSQL_DATABASE=$(oc get secret --namespace helm-mysql mysql-mysql -o jsonpath=\"{.data.database-name}\" | base64 --decode; echo)              \n                                                                                                                                                 \nTo connect to your database:                                                                                                                     \n                                                                                                                                                 \n(1). Run an Centos pod that you can use as a client:                                                                                               \n                                                                                                                                                 \n    oc run -i --rm --tty centos --image=centos\/mysql-57-centos7 --restart=Never -- bash -il                                                      \n                                                                                                                                                 \n(2). Connect using the mysql cli, then provide your password:                                                                                      \n    $ mysql -h mysql-mysql.helm-mysql.svc.cluster.local -u root -p${MYSQL_ROOT_PASSWORD} ${MYSQL_DATABASE}                                      \n                                                                                                                                                 \nTo connect to your database directly from outside the K8s cluster:                                                                               \n    MYSQL_HOST=127.0.0.1                                                                                                                         \n    MYSQL_PORT=3306                                                                                                                              \n                                                                                                                                                 \n    ## Execute the following commands to route the connection:                                                                                    \n    export POD_NAME=$(oc get pods --namespace helm-mysql -l \"app=mysql-mysql\" -o jsonpath=\"{.items[0].metadata.name}\"; echo)                    \n    oc port-forward --namespace helm-mysql $POD_NAME 3306:3306                                                                                  \n                                                                                                                                                 \n    mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} ${MYSQL_DATABASE}                                                    \n<\/pre>\n\n\n\n<p>4.\u67e5\u770b\u5e94\u7528\u7684Pod\u8fd0\u884c\u90e8\u7f72\u72b6\u6001<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ oc get pod -n helm-mysql\nNAME                           READY   STATUS    RESTARTS   AGE\nmysql-mysql-7dd478658f-cxjhh   1\/1     Running   0          34m\n<\/pre>\n\n\n\n<p><strong>\u5b9a\u5236Helm Chart<\/strong>(\u521b\u5efa\u65b0\u7684Helm Chart)<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>1.\u5728my-chart-nginx\u9879\u76ee\u4e2d\u521b\u5efa\u540d\u4e3amy-chart-nginx\u7684Chart\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ oc new-project my-chart-nginx\n$ helm create my-chart-nginx<\/pre>\n\n\n\n<p>2.\u67e5\u770bHelm\u521b\u5efa\u7684my-chart\u76ee\u5f55\u5305\u62ec\u7684\u8d44\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ tree my-chart-nginx\nmy-chart-nginx\n\u251c\u2500\u2500 charts\n\u251c\u2500\u2500 Chart.yaml\n\u251c\u2500\u2500 templates\n\u2502   \u251c\u2500\u2500 deployment.yaml\n\u2502   \u251c\u2500\u2500 _helpers.tpl\n\u2502   \u251c\u2500\u2500 hpa.yaml\n\u2502   \u251c\u2500\u2500 ingress.yaml\n\u2502   \u251c\u2500\u2500 NOTES.txt\n\u2502   \u251c\u2500\u2500 serviceaccount.yaml\n\u2502   \u251c\u2500\u2500 service.yaml\n\u2502   \u2514\u2500\u2500 tests\n\u2502       \u2514\u2500\u2500 test-connection.yaml\n\u2514\u2500\u2500 values.yaml\n \n3 directories, 10 files\n<\/pre>\n\n\n\n<p>3.\u4e3a\u4e86\u7b80\u5316\uff0c\u53ef\u4ee5\u5220\u9664\u4ee5\u4e0b\u4e0d\u5fc5\u8981\u7684\u914d\u7f6e\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ rm my-chart-nginx\/templates\/hpa.yaml\n$ rm my-chart-nginx\/templates\/ingress.yaml\n$ rm my-chart-nginx\/templates\/NOTES.txt\n$ rm my-chart-nginx\/templates\/serviceaccount.yaml\n<\/pre>\n\n\n\n<p>4.\u4fee\u6539my-chart-nginx\/templates\/deployment.yaml\u6587\u4ef6\uff0c\u786e\u4fdd\u6587\u4ef6\u4e3a\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: {{ include \"my-chart-nginx.fullname\" . }}\n  labels:\n    app.kubernetes.io\/name: {{ include \"my-chart-nginx.name\" . }}\n    helm.sh\/chart: {{ include \"my-chart-nginx.chart\" . }}\n    app.kubernetes.io\/instance: {{ .Release.Name }}\n    app.kubernetes.io\/managed-by: {{ .Release.Service }}\nspec:\n  replicas: {{ .Values.replicaCount }}\n  selector:\n    matchLabels:\n      app.kubernetes.io\/name: {{ include \"my-chart-nginx.name\" . }}\n      app.kubernetes.io\/instance: {{ .Release.Name }}\n  template:\n    metadata:\n      labels:\n        app.kubernetes.io\/name: {{ include \"my-chart-nginx.name\" . }}\n        app.kubernetes.io\/instance: {{ .Release.Name }}\n    spec:\n      containers:\n        - name: {{ .Chart.Name }}\n          image: \"{{ .Values.image.repository }}:{{ .Values.image.tag }}\"\n          imagePullPolicy: {{ .Values.image.pullPolicy }}\n          ports:\n            - name: http\n              containerPort: 8080\n              protocol: TCP\n<\/pre>\n\n\n\n<p>5.\u4fee\u6539my-chart-nginx\/templates\/service.yaml\u6587\u4ef6\uff0c\u786e\u4fdd\u6587\u4ef6\u4e3a\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apiVersion: v1\nkind: Service\nmetadata:\n  name: {{ include \"my-chart-nginx.fullname\" . }}\n  labels:\n    app.kubernetes.io\/name: {{ include \"my-chart-nginx.name\" . }}\n    helm.sh\/chart: {{ include \"my-chart-nginx.chart\" . }}\n    app.kubernetes.io\/instance: {{ .Release.Name }}\n    app.kubernetes.io\/managed-by: {{ .Release.Service }}\nspec:\n  type: {{ .Values.service.type }}\n  ports:\n    - port: {{ .Values.service.port }}\n      targetPort: http\n      protocol: TCP\n      name: http\n  selector:\n    app.kubernetes.io\/name: {{ include \"my-chart-nginx.name\" . }}\n    app.kubernetes.io\/instance: {{ .Release.Name }}\n<\/pre>\n\n\n\n<p>6.\u7f16\u8f91my-chart-nginx\/values.yaml\u6587\u4ef6\uff0c\u786e\u4fddimage\u90e8\u5206\u7684\u5185\u5bb9\u4e3a\u4ee5\u4e0b\u5185\u5bb9\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">replicaCount: 1\nimage:\n  repository: \"bitnami\/nginx\"\n  tag: \"latest\"\n  pullPolicy: IfNotPresent\nservice:\n  type: NodePort\n  port: 80\n<\/pre>\n\n\n\n<p>7.\u6267\u884c\u547d\u4ee4\u68c0\u67e5Chart\u76ee\u5f55\u4e2d\u8d44\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm lint .\/my-chart-nginx\/\n==> Linting .\/my-chart-nginx\/\n[INFO] Chart.yaml: icon is recommended\n \n1 chart(s) linted, 0 chart(s) failed\n<\/pre>\n\n\n\n<p>8.\u6267\u884c\u547d\u4ee4\uff0c\u6839\u636emy-chart\u521b\u5efa\u8d44\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm install my-chart-nginx .\/my-chart-nginx\nNAME: my-chart-nginx\nLAST DEPLOYED: Fri Dec 25 03:01:02 2020\nNAMESPACE: my-chart-nginx\nSTATUS: deployed\nREVISION: 1\n<\/pre>\n\n\n\n<p>9.\u6267\u884c\u547d\u4ee4\uff0c\u67e5\u770bhelm\u90e8\u7f72\u7684Chart\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm ls \nNAME            NAMESPACE       REVISION        UPDATED                                 STATUS          CHART                   APP VERSION\nmy-chart-nginx  my-chart-nginx  1               2020-12-25 03:01:02.016558706 +0000 UTC deployed        my-chart-nginx-0.1.0    1.16.0\n<\/pre>\n\n\n\n<p>10.\u67e5\u770b\u901a\u8fc7Chart\u90e8\u7f72\u7684\u8d44\u6e90\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ oc get all -n my-chart-nginx\nNAME                                  READY   STATUS    RESTARTS   AGE\npod\/my-chart-nginx-6d5876c89b-svx9w   1\/1     Running   0          108s\n \nNAME                     TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE\nservice\/my-chart-nginx   NodePort   172.30.83.106   &lt;none>        80:31047\/TCP   108s\n \nNAME                             READY   UP-TO-DATE   AVAILABLE   AGE\ndeployment.apps\/my-chart-nginx   1\/1     1            1           108s\n \nNAME                                        DESIRED   CURRENT   READY   AGE\nreplicaset.apps\/my-chart-nginx-6d5876c89b   1         1         1       108s\n<\/pre>\n\n\n\n<p>11.\u751f\u6210Route\uff0c\u7136\u540e\u7528\u6d4f\u89c8\u5668\u8bbf\u95eeroute<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ oc expose svc my-chart-nginx -n my-chart-nginx\nroute.route.openshift.io\/my-chart-nginx exposed\n$ oc get route -n my-chart-nginx\nNAME             HOST\/PORT                                                                             PATH   SERVICES         PORT   TERMINATION   WILDCARD\nmy-chart-nginx   my-chart-nginx-my-chart-nginx.apps.cluster-pek-99bc.pek-99bc.sandbox309.opentlc.com       \n<\/pre>\n\n\n\n<p><strong>\u4fee\u6539\u66f4\u65b0Helm Chart<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>1.\u5220\u9664\u521a\u521a\u624b\u52a8\u521b\u5efa\u7684Route\u5bf9\u8c61<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$  oc delete route my-chart-nginx  -n my-chart-nginx<\/pre>\n\n\n\n<p>2.\u65b0\u5efa\u5185\u5bb9\u5982\u4e0b\u7684my-chart-nginx\/templates\/routes.yaml\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apiVersion: route.openshift.io\/v1\nkind: Route\nmetadata:\n  name: {{ include \"my-chart-nginx.fullname\" . }}\n  labels:\n    {{- include \"my-chart-nginx.labels\" . | nindent 4 }}\nspec:\n  port:\n    targetPort: http\n  to:\n    kind: Service\n    name: {{ include \"my-chart-nginx.fullname\" . }}\n    weight: 100\n  wildcardPolicy: None\n<\/pre>\n\n\n\n<p>3.\u6267\u884c\u547d\u4ee4\uff0c\u66f4\u65b0Helm Chart<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ helm upgrade my-chart-nginx .\/my-chart-nginx\nRelease \"my-chart-nginx\" has been upgraded. Happy Helming!\nNAME: my-chart-nginx\nLAST DEPLOYED: Fri Dec 25 03:11:19 2020\nNAMESPACE: my-chart-nginx\nSTATUS: deployed\nREVISION: 2\n<\/pre>\n\n\n\n<p>4.\u786e\u8ba4\u5df2\u7ecfHelm\u521b\u5efa\u51faRoute\u7c7b\u578b\u5bf9\u8c61\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">$ oc get route -n my-chart-nginx\nNAME             HOST\/PORT                                                                             PATH   SERVICES         PORT   TERMINATION   WILDCARD\nmy-chart-nginx   my-chart-nginx-my-chart-nginx.apps.cluster-pek-99bc.pek-99bc.sandbox309.opentlc.com          my-chart-nginx   http                 None\n<\/pre>\n\n\n\n<p><strong>\u56de\u9000Helm Chart\u914d\u7f6e<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p>1.\u8fdb\u5165OpenShift\u7684\u201c<strong>\u5f00\u53d1\u8005<\/strong>\u201d\u89c6\u56fe\u7684\u201c<strong>Helm<\/strong>\u201d\u83dc\u5355\uff0c\u7136\u540e\u8fdb\u5165my-chart-nginx\uff0c\u5728\u201c<strong>Helm \u4fee\u6539\u5386\u53f2<\/strong>\u201d\u4e2d\u53ef\u4ee5\u770b\u5230Helm\u6bcf\u6b21\u66f4\u65b0\u7684\u8bb0\u5f55\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-192-1024x305.png\" alt=\"\" class=\"wp-image-10057\" width=\"639\" height=\"190\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192-1024x305.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192-300x89.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192-768x229.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192-830x247.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192-230x69.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192-350x104.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192-480x143.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-192.png 1504w\" sizes=\"(max-width: 639px) 100vw, 639px\" \/><\/figure><\/div>\n\n\n\n<p>2.\u5728my-chart-nginx\u7684\u201c<strong>\u8d44\u6e90<\/strong>\u201d\u4e2d\u53ef\u67e5\u770b\u901a\u8fc7Helm Chart\u521b\u5efa\u7684\u8d44\u6e90\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-193-1024x390.png\" alt=\"\" class=\"wp-image-10058\" width=\"630\" height=\"239\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193-1024x390.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193-300x114.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193-768x293.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193-830x316.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193-230x88.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193-350x133.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193-480x183.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-193.png 1522w\" sizes=\"(max-width: 630px) 100vw, 630px\" \/><\/figure><\/div>\n\n\n\n<p>3.\u70b9\u51fb\u4e0a\u56fe\u201c<strong>\u64cd\u4f5c<\/strong>\u201d\u4e0b\u62c9\u83dc\u5355\u4e2d\u7684\u201c<strong>\u56de\u6eda<\/strong>\u201d\u9879\u76ee\uff0c\u6b64\u65f6\u754c\u9762\u5c06\u663e\u793a\u4e0b\u56fe\u3002\u9009\u4e2d\u201c<strong>\u4fee\u8ba2<\/strong>\u201d\u4e3a\u201c1\u201d\u7684\u7248\u672c\uff0c\u7136\u540e\u70b9\u51fb\u201c<strong>\u56de\u6eda<\/strong>\u201d\u6309\u94ae\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-194-1024x319.png\" alt=\"\" class=\"wp-image-10059\" width=\"640\" height=\"199\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194-1024x319.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194-300x94.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194-768x240.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194-830x259.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194-230x72.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194-350x109.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194-480x150.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-194.png 1526w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/figure><\/div>\n\n\n\n<p>4.\u6b64\u65f6\u518d\u6b21\u67e5\u770bmy-chart-nginx\u7684\u201c<strong>\u8d44\u6e90<\/strong>\u201d\uff0c\u786e\u8ba4Route\u8d44\u6e90\u5df2\u7ecf\u6ca1\u6709\u4e86\u3002\u8fd9\u8bf4\u660eHelm Chart\u5df2\u7ecf\u56de\u9000\u5230\u6700\u5f00\u59cb\u7684\u914d\u7f6e\u4e86\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-195-1024x357.png\" alt=\"\" class=\"wp-image-10060\" width=\"643\" height=\"223\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195-1024x357.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195-300x104.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195-768x267.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195-830x289.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195-230x80.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195-350x122.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195-480x167.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-195.png 1528w\" sizes=\"(max-width: 643px) 100vw, 643px\" \/><\/figure><\/div>\n\n\n\n<p>5.\u518d\u6b21\u67e5\u770bmy-chart-nginx\u7684\u201c<strong>Helm \u4fee\u6539\u5386\u53f2<\/strong>\u201d\uff0c\u786e\u8ba4\u201c<strong>\u4fee\u8ba2<\/strong>\u201d\u5f53\u524d\u7248\u672c\u4e3a\u201c3\u201d\u3002\u6839\u636e\u63cf\u8ff0\uff0c\u201c3\u201d\u7248\u662f\u4ece\u201c1\u201d\u7248\u56de\u6eda\u7684\u3002<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/123.57.164.21\/wp-content\/uploads\/2023\/03\/image-196-1024x367.png\" alt=\"\" class=\"wp-image-10061\" width=\"634\" height=\"227\" srcset=\"https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196-1024x367.png 1024w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196-300x108.png 300w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196-768x275.png 768w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196-830x298.png 830w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196-230x82.png 230w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196-350x126.png 350w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196-480x172.png 480w, https:\/\/92it.top\/wp-content\/uploads\/2023\/03\/image-196.png 1500w\" sizes=\"(max-width: 634px) 100vw, 634px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 Helm \u662f Kubernetes \u7684\u5305\u7ba1\u7406\u5668\u3002\u5305\u7ba1\u7406\u5668\u7c7b\u4f3c\u4e8e\u6211\u4eec\u5728 Ubuntu \u4e2d\u4f7f\u7528\u7684apt\u3001Ce [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[22],"tags":[],"_links":{"self":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/10049"}],"collection":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10049"}],"version-history":[{"count":5,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/10049\/revisions"}],"predecessor-version":[{"id":10222,"href":"https:\/\/92it.top\/index.php?rest_route=\/wp\/v2\/posts\/10049\/revisions\/10222"}],"wp:attachment":[{"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10049"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10049"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/92it.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10049"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}