-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path468bc414.html
594 lines (427 loc) · 60 KB
/
468bc414.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 5.2.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&display=swap&subset=latin,latin-ext">
<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {"hostname":"www.sdevops.cn","root":"/","scheme":"Gemini","version":"7.8.0","exturl":false,"sidebar":{"position":"left","display":"always","b2t":false,"scrollpercent":true,"padding":18,"offset":12,"onmobile":false},"copycode":{"enable":true,"show_result":true,"style":null},"back2top":{"enable":true,"sidebar":false,"scrollpercent":false},"bookmark":{"enable":false,"color":"#222","save":"auto"},"fancybox":false,"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"algolia":{"hits":{"per_page":10},"labels":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}},"localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},"path":"search.xml"};
</script>
<meta name="description" content="对分区分服滚服业务Helm如何管理,需要不同小区对应一个value?或是不同小区对应一个templates的yaml小区模板? 那样太复杂了!另外对某些小区yaml个性化的编排配置如何管理呢?我告诉你答案!欢迎大家一起交流。 1.项目背景目前容器化业务多为全区全服业务,管理上多为一个集群一套环境,从头部署完成后,不需要考虑区服复用deployment/statefulset等,大多一对一的场景">
<meta property="og:type" content="article">
<meta property="og:title" content="当游戏遇见K8S-滚服业务如何用Helm管理">
<meta property="og:url" content="https://www.sdevops.cn/468bc414.html">
<meta property="og:site_name" content="Vaedit's Blog">
<meta property="og:description" content="对分区分服滚服业务Helm如何管理,需要不同小区对应一个value?或是不同小区对应一个templates的yaml小区模板? 那样太复杂了!另外对某些小区yaml个性化的编排配置如何管理呢?我告诉你答案!欢迎大家一起交流。 1.项目背景目前容器化业务多为全区全服业务,管理上多为一个集群一套环境,从头部署完成后,不需要考虑区服复用deployment/statefulset等,大多一对一的场景">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2022-01-04T14:32:37.000Z">
<meta property="article:modified_time" content="2022-01-04T14:56:09.795Z">
<meta property="article:author" content="Vaedit">
<meta property="article:tag" content="k8s,helm">
<meta name="twitter:card" content="summary">
<link rel="canonical" href="https://www.sdevops.cn/468bc414.html">
<script id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: "",
isHome : false,
isPost : true,
lang : 'zh-CN'
};
</script>
<title>当游戏遇见K8S-滚服业务如何用Helm管理 | Vaedit's Blog</title>
<noscript>
<style>
.use-motion .brand,
.use-motion .menu-item,
.sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-header { opacity: initial; }
.use-motion .site-title,
.use-motion .site-subtitle {
opacity: initial;
top: initial;
}
.use-motion .logo-line-before i { left: initial; }
.use-motion .logo-line-after i { right: initial; }
</style>
</noscript>
<link rel="alternate" href="/atom.xml" title="Vaedit's Blog" type="application/atom+xml">
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<div class="container use-motion">
<div class="headband">
<a target="_blank" rel="noopener" href="https://github.com/vaedit" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
</div>
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-nav-toggle">
<div class="toggle" aria-label="切换导航栏">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
</div>
<div class="site-meta">
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<h1 class="site-title">Vaedit's Blog</h1>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger">
<i class="fa fa-search fa-fw fa-lg"></i>
</div>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="main-menu menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section"><i class="home //首页 fa-fw"></i>首页</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section"><i class="archive //归档 fa-fw"></i>归档</a>
</li>
<li class="menu-item menu-item-categories">
<a href="/categories/" rel="section"><i class="th //分类 fa-fw"></i>分类</a>
</li>
<li class="menu-item menu-item-tags">
<a href="/tags/" rel="section"><i class="tags //标签 fa-fw"></i>标签</a>
</li>
<li class="menu-item menu-item-about">
<a href="/about/" rel="section"><i class="user //关于 fa-fw"></i>关于</a>
</li>
<li class="menu-item menu-item-search">
<a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索
</a>
</li>
</ul>
</nav>
<div class="search-pop-overlay">
<div class="popup search-popup">
<div class="search-header">
<span class="search-icon">
<i class="fa fa-search"></i>
</span>
<div class="search-input-container">
<input autocomplete="off" autocapitalize="off"
placeholder="搜索..." spellcheck="false"
type="search" class="search-input">
</div>
<span class="popup-btn-close">
<i class="fa fa-times-circle"></i>
</span>
</div>
<div id="search-result">
<div id="no-result">
<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
</div>
</div>
</div>
</div>
</div>
</header>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
<main class="main">
<div class="main-inner">
<div class="content-wrap">
<div class="content post posts-expand">
<article itemscope itemtype="http://schema.org/Article" class="post-block" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="https://www.sdevops.cn/468bc414.html">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.png">
<meta itemprop="name" content="Vaedit">
<meta itemprop="description" content="">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Vaedit's Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
当游戏遇见K8S-滚服业务如何用Helm管理
</h1>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2022-01-04 22:32:37" itemprop="dateCreated datePublished" datetime="2022-01-04T22:32:37+08:00">2022-01-04</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-folder"></i>
</span>
<span class="post-meta-item-text">分类于</span>
<span itemprop="about" itemscope itemtype="http://schema.org/Thing">
<a href="/categories/k8s%E7%94%9F%E6%80%81%E5%9C%88/" itemprop="url" rel="index"><span itemprop="name">k8s生态圈</span></a>
</span>
</span>
<span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv" style="display: none;">
<span class="post-meta-item-icon">
<i class="eye"></i>
</span>
<span class="post-meta-item-text">阅读次数:</span>
<span id="busuanzi_value_page_pv"></span>
</span><br>
<span class="post-meta-item" title="本文字数">
<span class="post-meta-item-icon">
<i class="far fa-file-word"></i>
</span>
<span class="post-meta-item-text">本文字数:</span>
<span>7.6k</span>
</span>
<span class="post-meta-item" title="阅读时长">
<span class="post-meta-item-icon">
<i class="far fa-clock"></i>
</span>
<span class="post-meta-item-text">阅读时长 ≈</span>
<span>7 分钟</span>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<blockquote>
<p>对分区分服滚服业务Helm如何管理,需要不同小区对应一个value?或是不同小区对应一个templates的yaml小区模板? 那样太复杂了!<br>另外对某些小区yaml个性化的编排配置如何管理呢?我告诉你答案!欢迎大家一起交流。</p>
</blockquote>
<h1 id="1-项目背景"><a href="#1-项目背景" class="headerlink" title="1.项目背景"></a>1.项目背景</h1><p>目前容器化业务多为全区全服业务,管理上多为一个集群一套环境,从头部署完成后,不需要考虑区服复用deployment/statefulset等,大多一对一的场景(一个deployment/statefulset,对应一个模块或用应用),配置文件也可以部署时,确定好后,后期变更较少。然而,滚服业务存在着大量复用deployment/statefulset/configmap/service/ingress等等控制器yaml模版,实现的方式也有多种,这里具体说下一个chart对应一个value管理多区服业务。</p>
<a id="more"></a>
<h1 id="2-Helm"><a href="#2-Helm" class="headerlink" title="2.Helm"></a>2.Helm</h1><h2 id="2-1-Helm介绍"><a href="#2-1-Helm介绍" class="headerlink" title="2.1 Helm介绍"></a>2.1 Helm介绍</h2><p>Helm是一个Kubernetes的包管理工具,就像Linux下的包管理器,如yum/apt等,可以很方便的将之前打包好的yaml文件部署到kubernetes上。</p>
<p>Helm有3个重要概念:</p>
<ul>
<li><strong>helm:</strong>一个命令行客户端工具,主要用于Kubernetes应用chart的创建、打包、发布和管理。</li>
<li><strong>Chart:</strong>应用描述,一系列用于描述 k8s 资源相关文件的集合。</li>
<li><strong>Release:</strong>基于Chart的部署实体,一个 chart 被 Helm 运行后将会生成对应的一个 release;将在k8s中创建出真实运行的资源对象。</li>
</ul>
<h2 id="2-2-Helm安装"><a href="#2-2-Helm安装" class="headerlink" title="2.2 Helm安装"></a>2.2 Helm安装</h2><p>使用helm很简单,你只需要下载一个二进制客户端包即可,会通过kubeconfig配置(通常$HOME/.kube/config)来连接Kubernetes。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">wget https://get.helm.sh/helm-v3.7.2-linux-amd64.tar.gz</span><br><span class="line"></span><br><span class="line">tar zxvf helm-v3.7.2-linux-amd64.tar.gz</span><br><span class="line"></span><br><span class="line">mv linux-amd64/helm /usr/bin/</span><br></pre></td></tr></table></figure>
<h1 id="3-制作一个Chart"><a href="#3-制作一个Chart" class="headerlink" title="3.制作一个Chart"></a>3.制作一个Chart</h1><p>Helm核心是模板,即模板化K8s YAML文件。部署多个应用时,将需要改动的字段进行模板化,可动态传入。</p>
<p>下面我们开始制作第一个Chart模拟创建多个区服,镜像使用nginx代替。</p>
<p>首先是value变量的配置(这里只放最基础的也是最常用的变量,如果需要自定义变量最好是通过配置文件挂载卷的方式挂载)</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># values.yaml</span></span><br><span class="line"><span class="comment"># 测试用例</span></span><br><span class="line"><span class="attr">yqcr:</span> <span class="comment">#项目名</span></span><br><span class="line"> <span class="attr">serverinfo:</span> <span class="comment"># 区服信息(这里只做游戏逻辑服最简单的示例,实际业务这一层还有其他全局模块等,可以灵活规划)</span></span><br><span class="line"> <span class="attr">10001:</span> <span class="comment"># 区服id</span></span><br><span class="line"> <span class="attr">cpu:</span> <span class="number">1</span></span><br><span class="line"> <span class="attr">mem:</span> <span class="string">1Gi</span></span><br><span class="line"> <span class="attr">images1:</span> <span class="string">nginx</span></span><br><span class="line"> <span class="attr">tag1:</span> <span class="number">1.21</span><span class="number">.4</span></span><br><span class="line"> <span class="attr">replicas:</span> <span class="number">2</span></span><br><span class="line"> <span class="attr">10002:</span></span><br><span class="line"> <span class="attr">cpu:</span> <span class="number">2</span></span><br><span class="line"> <span class="attr">mem:</span> <span class="string">2Gi</span></span><br><span class="line"> <span class="attr">images1:</span> <span class="string">nginx</span></span><br><span class="line"> <span class="attr">tag1:</span> <span class="number">1.20</span><span class="number">.2</span></span><br><span class="line"> <span class="attr">replicas:</span> <span class="number">1</span></span><br><span class="line"> <span class="attr">10003:</span></span><br><span class="line"> <span class="attr">cpu:</span> <span class="number">2</span></span><br><span class="line"> <span class="attr">mem:</span> <span class="string">2Gi</span></span><br><span class="line"> <span class="attr">10004:</span></span><br><span class="line"> <span class="attr">cpu:</span> <span class="number">2</span></span><br><span class="line"> <span class="attr">10005:</span></span><br><span class="line"> <span class="attr">images1:</span> <span class="string">nginx</span></span><br><span class="line"> <span class="attr">tag1:</span> <span class="number">1.20</span><span class="number">.2</span></span><br><span class="line"> <span class="attr">replicas:</span> <span class="number">1</span></span><br><span class="line"><span class="comment"># 默认配置信息(可以减少value行数,更加清晰,当使用默认配置时,只需要10001:即可)</span></span><br><span class="line"><span class="attr">Gamedefault:</span></span><br><span class="line"> <span class="attr">cpu:</span> <span class="number">1</span></span><br><span class="line"> <span class="attr">mem:</span> <span class="string">1Gi</span></span><br><span class="line"> <span class="attr">images1:</span> <span class="string">nginx</span></span><br><span class="line"> <span class="attr">tag1:</span> <span class="number">1.20</span><span class="number">.2</span></span><br><span class="line"> <span class="attr">replicas:</span> <span class="number">2</span></span><br></pre></td></tr></table></figure>
<p>template实例:</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 默认值定义</span></span><br><span class="line">{{ <span class="string">$default_res</span> <span class="string">:=</span> <span class="string">.Values.Gamedefault.replicas</span> }}</span><br><span class="line">{{ <span class="string">$default_cpu</span> <span class="string">:=</span> <span class="string">.Values.Gamedefault.cpu</span> }}</span><br><span class="line">{{ <span class="string">$default_mem</span> <span class="string">:=</span> <span class="string">.Values.Gamedefault.mem</span> }}</span><br><span class="line">{{ <span class="string">$default_images1</span> <span class="string">:=</span> <span class="string">.Values.Gamedefault.images1</span> }}</span><br><span class="line">{{ <span class="string">$default_tag1</span> <span class="string">:=</span> <span class="string">.Values.Gamedefault.tag1</span> }}</span><br><span class="line"><span class="comment"># 遍历区服map</span></span><br><span class="line">{{<span class="bullet">-</span> <span class="string">range</span> <span class="string">$key</span>, <span class="string">$value</span> <span class="string">:=</span> <span class="string">.Values.yqcr.serverinfo</span> }}</span><br><span class="line"><span class="comment"># 如果区服使用特殊配置</span></span><br><span class="line">{{<span class="bullet">-</span> <span class="string">if</span> <span class="string">$value</span> }}</span><br><span class="line"><span class="attr">apiVersion:</span> <span class="string">apps/v1</span></span><br><span class="line"><span class="attr">kind:</span> <span class="string">Deployment</span></span><br><span class="line"><span class="attr">metadata:</span></span><br><span class="line"> <span class="attr">labels:</span> </span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">namespace:</span> <span class="string">jhxjy-tiyan</span></span><br><span class="line"><span class="attr">spec:</span></span><br><span class="line"> <span class="attr">progressDeadlineSeconds:</span> <span class="number">600</span> <span class="comment"># deploy升级的最大时间</span></span><br><span class="line"> <span class="comment"># 进一步判断是否有这个key,如果有则使用</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">if</span> <span class="string">hasKey</span> <span class="string">$value</span> <span class="string">"replicas"</span> }} </span><br><span class="line"> <span class="attr">replicas:</span> {{ <span class="string">$value.replicas</span> }}</span><br><span class="line"> <span class="comment"># 没有这个key,则使用默认值</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">else</span> }}</span><br><span class="line"> <span class="attr">replicas:</span> {{ <span class="string">$default_res</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line"> <span class="attr">revisionHistoryLimit:</span> <span class="number">10</span></span><br><span class="line"> <span class="attr">selector:</span></span><br><span class="line"> <span class="attr">matchLabels:</span> </span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">strategy:</span></span><br><span class="line"> <span class="attr">rollingUpdate:</span> {<span class="attr">maxSurge:</span> <span class="number">25</span><span class="string">%</span>, <span class="attr">maxUnavailable:</span> <span class="number">25</span><span class="string">%</span>}</span><br><span class="line"> <span class="attr">type:</span> <span class="string">RollingUpdate</span></span><br><span class="line"> <span class="attr">template:</span></span><br><span class="line"> <span class="attr">metadata:</span></span><br><span class="line"> <span class="attr">labels:</span> </span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">spec:</span></span><br><span class="line"> <span class="attr">containers:</span></span><br><span class="line"> <span class="comment"># 模拟某些程序启动时需要注入serverid或者类似的变量</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">args:</span> [<span class="string">"bash"</span>,<span class="string">"-c"</span>,<span class="string">"echo <span class="template-variable">{{ $key }}</span> && sleep 600000"</span> ]</span><br><span class="line"> <span class="attr">env:</span></span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">name:</span> <span class="string">EXP_DATA_DOMAIN</span>, <span class="attr">value:</span> <span class="string">xxx</span>}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">if</span> <span class="string">and</span> <span class="string">(hasKey</span> <span class="string">$value</span> <span class="string">"images1"</span><span class="string">)</span> <span class="string">(hasKey</span> <span class="string">$value</span> <span class="string">"tag1"</span><span class="string">)</span> }}</span><br><span class="line"> <span class="attr">image:</span> <span class="string">'<span class="template-variable">{{ $value.images1 }}</span>:<span class="template-variable">{{ $value.tag1 }}</span>'</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">else</span> }}</span><br><span class="line"> <span class="attr">image:</span> <span class="string">'<span class="template-variable">{{ $default_images1 }}</span>:<span class="template-variable">{{ $default_tag1 }}</span>'</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line"> <span class="attr">imagePullPolicy:</span> <span class="string">Always</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">containerPort:</span> <span class="number">80</span></span><br><span class="line"> <span class="attr">protocol:</span> <span class="string">TCP</span></span><br><span class="line"> <span class="comment"># 如果一个container有多个对外的端口可以通过计算来得出,只是示例用法,具体其实这一层的端口完全可以固定,在ingress那里需要通过serverid来动态计算</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">containerPort:</span> {{ <span class="string">add</span> <span class="number">2</span> <span class="string">(mul</span> <span class="string">$key</span> <span class="number">2</span><span class="string">)</span> }}</span><br><span class="line"> <span class="attr">protocol:</span> <span class="string">TCP</span></span><br><span class="line"> <span class="attr">resources:</span></span><br><span class="line"> <span class="attr">limits:</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">if</span> <span class="string">hasKey</span> <span class="string">$value</span> <span class="string">"cpu"</span> }}</span><br><span class="line"> <span class="attr">cpu:</span> {{ <span class="string">$value.cpu</span> <span class="string">|</span> <span class="string">quote</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">else</span> }}</span><br><span class="line"> <span class="attr">cpu:</span> {{ <span class="string">$default_cpu</span> <span class="string">|</span> <span class="string">quote</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">if</span> <span class="string">hasKey</span> <span class="string">$value</span> <span class="string">"mem"</span> }}</span><br><span class="line"> <span class="attr">memory:</span> {{ <span class="string">$value.mem</span> }}<span class="string">}</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">else</span> }}</span><br><span class="line"> <span class="attr">memory:</span> {{ <span class="string">$default_mem</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line"> <span class="attr">requests:</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">if</span> <span class="string">hasKey</span> <span class="string">$value</span> <span class="string">"cpu"</span> }}</span><br><span class="line"> <span class="attr">cpu:</span> {{ <span class="string">$value.cpu</span> <span class="string">|</span> <span class="string">quote</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">else</span> }}</span><br><span class="line"> <span class="attr">cpu:</span> {{ <span class="string">$default_cpu</span> <span class="string">|</span> <span class="string">quote</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">if</span> <span class="string">hasKey</span> <span class="string">$value</span> <span class="string">"mem"</span> }}</span><br><span class="line"> <span class="attr">memory:</span> {{ <span class="string">$value.mem</span> }}<span class="string">}</span></span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">else</span> }}</span><br><span class="line"> <span class="attr">memory:</span> {{ <span class="string">$default_mem</span> }}</span><br><span class="line"> {{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line"> <span class="attr">securityContext:</span> {<span class="attr">privileged:</span> <span class="literal">false</span>}</span><br><span class="line"> <span class="attr">terminationMessagePath:</span> <span class="string">/dev/termination-log</span></span><br><span class="line"> <span class="attr">terminationMessagePolicy:</span> <span class="string">File</span></span><br><span class="line"> <span class="attr">volumeMounts:</span></span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">mountPath:</span> <span class="string">/data/config</span>, <span class="attr">name:</span> <span class="string">config</span>}</span><br><span class="line"> <span class="attr">dnsPolicy:</span> <span class="string">ClusterFirst</span></span><br><span class="line"> <span class="attr">restartPolicy:</span> <span class="string">Always</span></span><br><span class="line"> <span class="attr">schedulerName:</span> <span class="string">default-scheduler</span></span><br><span class="line"> <span class="attr">securityContext:</span> {}</span><br><span class="line"> <span class="attr">terminationGracePeriodSeconds:</span> <span class="number">30</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="comment"># 配置精准挂载(如:10001/game/gameserver)</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">hostPath:</span> {<span class="attr">path:</span> <span class="string">"/data/config/<span class="template-variable">{{ $key }}</span>/chatservice-chat"</span>, <span class="attr">type:</span> <span class="string">''</span>}</span><br><span class="line"> <span class="attr">name:</span> <span class="string">config</span></span><br><span class="line"><span class="meta">---</span></span><br><span class="line"><span class="attr">apiVersion:</span> <span class="string">v1</span></span><br><span class="line"><span class="attr">kind:</span> <span class="string">Service</span></span><br><span class="line"><span class="attr">metadata:</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">namespace:</span> <span class="string">jhxjy-tiyan</span></span><br><span class="line"><span class="attr">spec:</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">"80"</span></span><br><span class="line"> <span class="attr">port:</span> {{ <span class="string">$key</span> }}</span><br><span class="line"> <span class="attr">protocol:</span> <span class="string">TCP</span></span><br><span class="line"> <span class="attr">targetPort:</span> <span class="number">80</span></span><br><span class="line"> <span class="attr">selector:</span></span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">sessionAffinity:</span> <span class="string">None</span></span><br><span class="line"> <span class="attr">type:</span> <span class="string">ClusterIP</span></span><br><span class="line"><span class="meta">---</span></span><br><span class="line"><span class="comment"># 如果使用默认配置</span></span><br><span class="line">{{<span class="bullet">-</span> <span class="string">else</span> }}</span><br><span class="line"><span class="attr">apiVersion:</span> <span class="string">apps/v1</span></span><br><span class="line"><span class="attr">kind:</span> <span class="string">Deployment</span></span><br><span class="line"><span class="attr">metadata:</span></span><br><span class="line"> <span class="attr">labels:</span> </span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">namespace:</span> <span class="string">jhxjy-tiyan</span></span><br><span class="line"><span class="attr">spec:</span></span><br><span class="line"> <span class="attr">progressDeadlineSeconds:</span> <span class="number">600</span></span><br><span class="line"> <span class="attr">replicas:</span> {{ <span class="string">$default_res</span> }}</span><br><span class="line"> <span class="attr">revisionHistoryLimit:</span> <span class="number">10</span></span><br><span class="line"> <span class="attr">selector:</span></span><br><span class="line"> <span class="attr">matchLabels:</span> </span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">strategy:</span></span><br><span class="line"> <span class="attr">rollingUpdate:</span> {<span class="attr">maxSurge:</span> <span class="number">25</span><span class="string">%</span>, <span class="attr">maxUnavailable:</span> <span class="number">25</span><span class="string">%</span>}</span><br><span class="line"> <span class="attr">type:</span> <span class="string">RollingUpdate</span></span><br><span class="line"> <span class="attr">template:</span></span><br><span class="line"> <span class="attr">metadata:</span></span><br><span class="line"> <span class="attr">labels:</span> </span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">spec:</span></span><br><span class="line"> <span class="attr">containers:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">args:</span> [<span class="string">"bash"</span>,<span class="string">"-c"</span>,<span class="string">"echo <span class="template-variable">{{ $key }}</span> && sleep 600000"</span> ]</span><br><span class="line"> <span class="attr">env:</span></span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">name:</span> <span class="string">EXP_DATA_DOMAIN</span>, <span class="attr">value:</span> <span class="string">xxx</span>}</span><br><span class="line"> <span class="attr">image:</span> <span class="string">'<span class="template-variable">{{ $default_images1 }}</span>:<span class="template-variable">{{ $default_tag1 }}</span>'</span></span><br><span class="line"> <span class="attr">imagePullPolicy:</span> <span class="string">Always</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">containerPort:</span> <span class="number">80</span></span><br><span class="line"> <span class="attr">protocol:</span> <span class="string">TCP</span></span><br><span class="line"> <span class="attr">resources:</span></span><br><span class="line"> <span class="attr">limits:</span> </span><br><span class="line"> <span class="attr">cpu:</span> {{ <span class="string">$default_cpu</span> <span class="string">|</span> <span class="string">quote</span> }}</span><br><span class="line"> <span class="attr">memory:</span> {{ <span class="string">$default_mem</span> }}</span><br><span class="line"> <span class="attr">requests:</span> </span><br><span class="line"> <span class="attr">cpu:</span> {{ <span class="string">$default_cpu</span> <span class="string">|</span> <span class="string">quote</span> }}</span><br><span class="line"> <span class="attr">memory:</span> {{ <span class="string">$default_mem</span> }}</span><br><span class="line"> <span class="attr">securityContext:</span> {<span class="attr">privileged:</span> <span class="literal">false</span>}</span><br><span class="line"> <span class="attr">terminationMessagePath:</span> <span class="string">/dev/termination-log</span></span><br><span class="line"> <span class="attr">terminationMessagePolicy:</span> <span class="string">File</span></span><br><span class="line"> <span class="attr">volumeMounts:</span></span><br><span class="line"> <span class="bullet">-</span> {<span class="attr">mountPath:</span> <span class="string">/data/config</span>, <span class="attr">name:</span> <span class="string">config</span>}</span><br><span class="line"> <span class="attr">dnsPolicy:</span> <span class="string">ClusterFirst</span></span><br><span class="line"> <span class="attr">restartPolicy:</span> <span class="string">Always</span></span><br><span class="line"> <span class="attr">schedulerName:</span> <span class="string">default-scheduler</span></span><br><span class="line"> <span class="attr">securityContext:</span> {}</span><br><span class="line"> <span class="attr">terminationGracePeriodSeconds:</span> <span class="number">30</span></span><br><span class="line"> <span class="attr">volumes:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">hostPath:</span> {<span class="attr">path:</span> <span class="string">"/data/config/<span class="template-variable">{{ $key }}</span>/chatservice-chat"</span>, <span class="attr">type:</span> <span class="string">''</span>}</span><br><span class="line"> <span class="attr">name:</span> <span class="string">config</span></span><br><span class="line"><span class="meta">---</span></span><br><span class="line"><span class="attr">apiVersion:</span> <span class="string">v1</span></span><br><span class="line"><span class="attr">kind:</span> <span class="string">Service</span></span><br><span class="line"><span class="attr">metadata:</span></span><br><span class="line"> <span class="attr">name:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">namespace:</span> <span class="string">jhxjy-tiyan</span></span><br><span class="line"><span class="attr">spec:</span></span><br><span class="line"> <span class="attr">ports:</span></span><br><span class="line"> <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">"80"</span></span><br><span class="line"> <span class="attr">port:</span> {{ <span class="string">$key</span> }}</span><br><span class="line"> <span class="attr">protocol:</span> <span class="string">TCP</span></span><br><span class="line"> <span class="attr">targetPort:</span> <span class="number">80</span></span><br><span class="line"> <span class="attr">selector:</span></span><br><span class="line"> <span class="attr">k8s-app:</span> <span class="string">chatservice-chat-{{</span> <span class="string">$key</span> <span class="string">}}</span></span><br><span class="line"> <span class="attr">sessionAffinity:</span> <span class="string">None</span></span><br><span class="line"> <span class="attr">type:</span> <span class="string">ClusterIP</span></span><br><span class="line"><span class="meta">---</span></span><br><span class="line">{{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line">{{<span class="bullet">-</span> <span class="string">end</span> }}</span><br><span class="line"></span><br><span class="line"></span><br></pre></td></tr></table></figure>
<h2 id="3-1-Yaml调试渲染"><a href="#3-1-Yaml调试渲染" class="headerlink" title="3.1 Yaml调试渲染"></a>3.1 Yaml调试渲染</h2><p>yaml 文件写好就该是同步和部署了,在部署前可以先用以下命令测试下,渲染不执行:</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">helm install releasename chart目录 --dry-run --debug</span><br><span class="line"><span class="comment">#部署</span></span><br><span class="line">helm install deploy20211214 <span class="built_in">test</span> -n namespace</span><br><span class="line"><span class="comment">#查看release</span></span><br><span class="line">helm ls -n namespace</span><br><span class="line"><span class="comment">#卸载</span></span><br><span class="line">helm uninstall deploy20211214 -n namespace</span><br></pre></td></tr></table></figure>
<h1 id="4-总结"><a href="#4-总结" class="headerlink" title="4.总结"></a>4.总结</h1><p>通过这种方式,覆盖了游戏版本更新,硬件配置升级,配置精准挂载等通用化操作,都只需要维护一个value,并且拓补清晰,降低了运维维护成本,同时又通用高效</p>
</div>
<div>
<ul class="post-copyright">
<li class="post-copyright-author">
<strong>本文作者: </strong>Vaedit
</li>
<li class="post-copyright-link">
<strong>本文链接:</strong>
<a href="https://www.sdevops.cn/468bc414.html" title="当游戏遇见K8S-滚服业务如何用Helm管理">https://www.sdevops.cn/468bc414.html</a>
</li>
<li class="post-copyright-license">
<strong>版权声明: </strong>本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处!
</li>
</ul>
</div>
<footer class="post-footer">
<div class="post-tags">
<a href="/tags/k8s-helm/" rel="tag"># k8s,helm</a>
</div>
<div class="post-nav">
<div class="post-nav-item">
<a href="/4f4cf82f.html" rel="prev" title="爬虫之新浪热点获取">
<i class="fa fa-chevron-left"></i> 爬虫之新浪热点获取
</a></div>
<div class="post-nav-item"></div>
</div>
</footer>
</article>
</div>
<script>
window.addEventListener('tabs:register', () => {
let { activeClass } = CONFIG.comments;
if (CONFIG.comments.storage) {
activeClass = localStorage.getItem('comments_active') || activeClass;
}
if (activeClass) {
let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
if (activeTab) {
activeTab.click();
}
}
});
if (CONFIG.comments.storage) {
window.addEventListener('tabs:click', event => {
if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
let commentClass = event.target.classList[1];
localStorage.setItem('comments_active', commentClass);
});
}
</script>
</div>
<div class="toggle sidebar-toggle">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
<aside class="sidebar">
<div class="sidebar-inner">
<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc">
文章目录
</li>
<li class="sidebar-nav-overview">
站点概览
</li>
</ul>
<!--noindex-->
<div class="post-toc-wrap sidebar-panel">
<div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#1-%E9%A1%B9%E7%9B%AE%E8%83%8C%E6%99%AF"><span class="nav-text">1.项目背景</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#2-Helm"><span class="nav-text">2.Helm</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#2-1-Helm%E4%BB%8B%E7%BB%8D"><span class="nav-text">2.1 Helm介绍</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-2-Helm%E5%AE%89%E8%A3%85"><span class="nav-text">2.2 Helm安装</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#3-%E5%88%B6%E4%BD%9C%E4%B8%80%E4%B8%AAChart"><span class="nav-text">3.制作一个Chart</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#3-1-Yaml%E8%B0%83%E8%AF%95%E6%B8%B2%E6%9F%93"><span class="nav-text">3.1 Yaml调试渲染</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#4-%E6%80%BB%E7%BB%93"><span class="nav-text">4.总结</span></a></li></ol></div>
</div>
<!--/noindex-->
<div class="site-overview-wrap sidebar-panel">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<img class="site-author-image" itemprop="image" alt="Vaedit"
src="/images/avatar.png">
<p class="site-author-name" itemprop="name">Vaedit</p>
<div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">41</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-categories">
<a href="/categories/">
<span class="site-state-item-count">12</span>
<span class="site-state-item-name">分类</span></a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/">
<span class="site-state-item-count">34</span>
<span class="site-state-item-name">标签</span></a>
</div>
</nav>
</div>
<div class="links-of-author motion-element">
<span class="links-of-author-item">
<a href="https://github.com/vaedit" title="GitHub → https://github.com/vaedit" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
</span>
<span class="links-of-author-item">
<a href="mailto:[email protected]" title="E-Mail → mailto:[email protected]" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
</span>
</div>
<div class="cc-license motion-element" itemprop="license">
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" class="cc-opacity" rel="noopener" target="_blank"><img src="/images/cc-by-nc-sa.svg" alt="Creative Commons"></a>
</div>
<div class="links-of-blogroll motion-element">
<div class="links-of-blogroll-title"><i class="fa fa-link fa-fw"></i>
Links
</div>
<ul class="links-of-blogroll-list">
<li class="links-of-blogroll-item">
<a href="https://blog.51cto.com/vaedit" title="https://blog.51cto.com/vaedit" rel="noopener" target="_blank">51CTO</a>
</li>
</ul>
</div>
</div>
</div>
</aside>
<div id="sidebar-dimmer"></div>
</div>
</main>
<footer class="footer">
<div class="footer-inner">
<div class="copyright">
©
<span itemprop="copyrightYear">2022</span>
<span class="with-love">
<i class="heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">Vaedit</span>
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-chart-area"></i>
</span>
<span title="站点总字数">113k</span>
<span class="post-meta-divider">|</span>
<span class="post-meta-item-icon">
<i class="fa fa-coffee"></i>
</span>
<span title="站点阅读时长">1:43</span>
</div>
<script async src="//dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<div class="busuanzi-count">
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<span class="post-meta-item" id="busuanzi_container_site_uv" style="display: none;">
<span class="post-meta-item-icon">
<i class="user"></i>
</span>
<span class="site-uv" title="总访客量">
<span id="busuanzi_value_site_uv"></span>
</span>
</span>
<span class="post-meta-divider">|</span>
<span class="post-meta-item" id="busuanzi_container_site_pv" style="display: none;">
<span class="post-meta-item-icon">
<i class="eye"></i>
</span>
<span class="site-pv" title="总访问量">
<span id="busuanzi_value_site_pv"></span>
</span>
</span>
</div>
</div>
</footer>
</div>
<script src="/lib/anime.min.js"></script>
<script src="/lib/velocity/velocity.min.js"></script>
<script src="/lib/velocity/velocity.ui.min.js"></script>
<script src="/js/utils.js"></script>
<script src="/js/motion.js"></script>
<script src="/js/schemes/pisces.js"></script>
<script src="/js/next-boot.js"></script>
<script>
(function(){
var canonicalURL, curProtocol;
//Get the <link> tag
var x=document.getElementsByTagName("link");
//Find the last canonical URL
if(x.length > 0){
for (i=0;i<x.length;i++){
if(x[i].rel.toLowerCase() == 'canonical' && x[i].href){
canonicalURL=x[i].href;
}
}
}
//Get protocol
if (!canonicalURL){
curProtocol = window.location.protocol.split(':')[0];
}
else{
curProtocol = canonicalURL.split(':')[0];
}
//Get current URL if the canonical URL does not exist
if (!canonicalURL) canonicalURL = window.location.href;
//Assign script content. Replace current URL with the canonical URL
!function(){var e=/([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,r=canonicalURL,t=document.referrer;if(!e.test(r)){var n=(String(curProtocol).toLowerCase() === 'https')?"https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif":"//api.share.baidu.com/s.gif";t?(n+="?r="+encodeURIComponent(document.referrer),r&&(n+="&l="+r)):r&&(n+="?l="+r);var i=new Image;i.src=n}}(window);})();
</script>
<script src="/js/local-search.js"></script>
</body>
</html>