|
|
) ~$ ~4 v- ]5 C R" N<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>) t9 @5 w) s5 W
<p> </p>
$ {) d K3 `$ m; F/ G, `7 D1 O<p>一、命令自动补全</p>4 W3 U0 A, o- X* H' h
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>
! M5 j3 Q+ C3 v7 R. B4 w<p>1、安装auto-completion工具</p>) Z- L( }# y" q' q4 I/ T. q
<div class="cnblogs_code">
% \5 Y. S6 T$ q0 s<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update
3 ?3 t- p* r6 g0 B3 _Hit:</span><span style="color: rgba(128, 0, 128, 1)">1</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">archive.ubuntu.com/ubuntu bionic InRelease</span>" f* ^8 d& a, H7 y+ R. F
Hit:<span style="color: rgba(128, 0, 128, 1)">2</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">security.ubuntu.com/ubuntu bionic-security InRelease</span>6 o/ ~8 s, X/ B3 l
Hit:<span style="color: rgba(128, 0, 128, 1)">3</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">archive.ubuntu.com/ubuntu bionic-updates InRelease</span>1 ?3 i" \& y3 k
Hit:<span style="color: rgba(128, 0, 128, 1)">4</span> https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">download.docker.com/linux/ubuntu bionic InRelease</span>
- B# j& b) }/ p7 e" t0 |! I1 fHit:<span style="color: rgba(128, 0, 128, 1)">5</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">archive.ubuntu.com/ubuntu bionic-backports InRelease</span>
. Q- Z6 R) Z8 u: t5 R6 j<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
, X( D1 @4 |: O9 Y2 q/ wBuilding dependency tree6 J6 _8 V# M7 F
Reading state information... Done
& }7 e' y: K9 I1 o5 i" B</span><span style="color: rgba(128, 0, 128, 1)">144</span> packages can be upgraded. Run <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">apt list --upgradable</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)"> to see them.
0 A: I( p5 g! A0 a6 Y( M: m$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> apt <span style="color: rgba(0, 0, 255, 1)">install</span> bash-<span style="color: rgba(0, 0, 0, 1)">completion: C" H: r/ H c* l5 U ]: y
Reading package lists... Done
* I4 m$ b5 X( DBuilding dependency tree& O! |1 J* r9 D
Reading state information... Done E6 |& d- F/ D2 u( F: T+ E: j' I
bash</span>-completion is already the newest version (<span style="color: rgba(128, 0, 128, 1)">1</span>:<span style="color: rgba(128, 0, 128, 1)">2.8</span>-<span style="color: rgba(0, 0, 0, 1)">1ubuntu1). u, }2 `) F; E! q: c4 k b0 ?& w l
</span><span style="color: rgba(128, 0, 128, 1)">0</span> upgraded, <span style="color: rgba(128, 0, 128, 1)">0</span> newly installed, <span style="color: rgba(128, 0, 128, 1)">0</span> to remove and <span style="color: rgba(128, 0, 128, 1)">144</span> not upgraded.</pre>* D- n% a4 A' Z
</div>' O( P+ @9 Y" L! N! _7 C$ n
<p>PS:如果是centos系统,则使用<span class="js_darkmode__0" data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)" data-style="color: rgb(0, 82, 255);"><strong data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)">yum install bash-completion -y</strong>命令安装</span></p>
V1 C* T5 D: l* k5 J<p>2、<span class="js_darkmode__1" data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)" data-style="color: rgb(0, 0, 0);">配置自动补全<br></span></p>6 s7 D: M2 K; k
<p><span class="js_darkmode__2" data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)" data-style="color: rgb(0, 0, 0);"><strong data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)">Bash</strong>:</span></p>
8 ~ C% P( ?% `2 H* r6 E<div class="cnblogs_code"># j) ?! T; s3 Z( M! \, ?
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)/ F- x/ \1 o; \; x6 W; a- C1 v
</span><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">source <(kubectl completion bash)</span><span style="color: rgba(128, 0, 0, 1)">"</span> >> ~/.bashrc</pre>
$ k6 v) j* j2 O3 u0 o</div>, q: g; S8 J0 h, ` W1 G: }4 z1 g
<p><strong>Zsh</strong>:</p>
; S5 h N2 c) [( h" F5 I6 X+ ?# k<div class="cnblogs_code">" n% p+ n+ D9 A: }' ^9 R* \9 T
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)# Q- n; u; h; j/ W" [
</span><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">[[ $commands[kubectl] ]] && source <(kubectl completion zsh)</span><span style="color: rgba(128, 0, 0, 1)">"</span> >> ~/.zshrc</pre>
* V6 K) w: P% K' I! [% E4 g3 p: C</div>1 _/ r0 f, U q, [. y4 S! p8 [! A. Y
<p>配置后就可以通过Tab键自动补全命令啦!</p>% @# |; Q* \: J0 h( t4 u! m' T. }
<p> </p>
5 [5 f- b& h0 [% u<p>二、配置kubectl别名</p>8 i: a2 z: O z
<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
8 C0 g* J+ d# L6 W0 L* |. Z<div class="cnblogs_code">
A+ R( B |. ?# L+ T<pre>alias <span style="color: rgba(0, 0, 255, 1)">sudo</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">sudo </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">
) B2 G4 }' F5 h3 x+ \) r- yalias k</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">
5 |: F+ l/ O' C9 S) L" s8 Salias ka</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl apply --recursive -f</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">
3 x- ]& V7 y8 _alias kex</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl exec -i -t</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">1 |% u" F4 T6 M. A& f/ l2 x
alias klo</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl logs -f</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">( m' w) f3 O7 o
alias kg</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl get</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">
5 f9 n3 p1 V0 S' W0 c k* S' Galias kd</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl describe</span><span style="color: rgba(128, 0, 0, 1)">'</span></pre>
. e/ V/ F& f+ r0 g+ n7 P</div>( |: Z' t0 d6 [9 X/ t7 X
<p><span class="js_darkmode__4" data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)" data-style="color: rgb(0, 82, 255);"><strong data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)">PS:alias sudo是为了解决sudo下别名不可用问题</strong><br></span></p>- F& o2 S7 |/ F3 O
<p><span class="js_darkmode__5" data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)" data-style="color: rgb(0, 0, 0);">保存后记得执行 source ~/.bashrc哈,接着我们体验下:</span></p>6 }# ~- Z- {9 x4 j z, r5 a8 T
<div class="cnblogs_code">
( L$ R% X3 t" J# v9 d0 e<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml
5 ^9 c- f7 z$ z2 Tpod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created1 k5 R0 f! L9 V3 n8 q
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods; t9 j7 U( j q3 Z1 E1 f* k, M
NAME READY STATUS RESTARTS AGE
" l+ H0 ~$ N* w4 ^7 b6 e' Qwebapp </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(128, 0, 128, 1)">2</span> ContainerCreating <span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)"> 7s
5 V- l8 Q) }8 u0 i$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
, {2 T5 E4 m2 T+ b T, }1 @4 IName: webapp
9 N8 Y8 E, D( G) N+ e6 P: }, kNamespace: default0 K A5 V! e4 ~5 Q- [5 L \) V r
Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">) Z& R( Y6 P3 _. k; I+ w
Node: ayato</span>/<span style="color: rgba(128, 0, 128, 1)">172.16</span>.<span style="color: rgba(128, 0, 128, 1)">194.135</span><span style="color: rgba(0, 0, 0, 1)">
5 c" s/ |/ Y5 z2 QStart Time: Wed, </span><span style="color: rgba(128, 0, 128, 1)">09</span> Feb <span style="color: rgba(128, 0, 128, 1)">2022</span> <span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">44</span> +<span style="color: rgba(128, 0, 128, 1)">0000</span><span style="color: rgba(0, 0, 0, 1)">
- y! t' j, y ?2 E1 ?; vLabels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp, U- m3 `# P$ F0 W- c* L# r
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">- {2 p8 ?$ ?, \9 R' @
Status: Running# Q( e5 h5 S0 e' J. Y. C- c
IP: </span><span style="color: rgba(128, 0, 128, 1)">172.17</span>.<span style="color: rgba(128, 0, 128, 1)">0.6</span><span style="color: rgba(0, 0, 0, 1)">
, W9 B7 J( n) Z0 X) M2 l1 TIPs:
) E; q# s, j: r1 @ IP: </span><span style="color: rgba(128, 0, 128, 1)">172.17</span>.<span style="color: rgba(128, 0, 128, 1)">0.6</span><span style="color: rgba(0, 0, 0, 1)">6 r. k3 ^; n& M6 {: L0 y! y
Containers:
, U3 V# H3 k; z webapp:) u: c4 E2 P$ y7 } h
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>! p- X' V/ ^& t" ^! G. M
Image: <span style="color: rgba(128, 0, 128, 1)">172.16</span>.<span style="color: rgba(128, 0, 128, 1)">194.135</span>:<span style="color: rgba(128, 0, 128, 1)">5000</span>/webapp:<span style="color: rgba(128, 0, 128, 1)">1.0</span><span style="color: rgba(0, 0, 0, 1)">
+ M& e; W% u; d7 [+ ] Image ID: docker</span>-pullable:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">172.16.194.135:5000/webapp@sha256:df3a447a013ada0642dec67bb31976f42f1a0699a68873d0452f514fa24e5c77</span>
/ }: m1 l# u( T6 y1 J9 h; t7 ^* o Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
. p! ^; \2 J; o/ z Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP0 ] ?! I) ?8 H7 g% R, _) n& q' J) S
State: Running
" O2 G9 b# w8 M- w Started: Wed, </span><span style="color: rgba(128, 0, 128, 1)">09</span> Feb <span style="color: rgba(128, 0, 128, 1)">2022</span> <span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">46</span> +<span style="color: rgba(128, 0, 128, 1)">0000</span><span style="color: rgba(0, 0, 0, 1)">" U& l1 j& K- c- e! z& D
Ready: True
8 v- i6 @ X$ P5 d* | Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">" Y5 A/ _8 J5 @* N. U# C
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)"> p' {; O& ?& {& H z* d
Mounts:
# v5 Y. R! t& u7 E! c </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)7 u0 v2 Q9 c7 X4 |
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)7 k J+ \. s& ]; U
busybox: s3 N8 Y5 k, B# r
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>7 s/ `; N& z1 W& x6 ?5 q
<span style="color: rgba(0, 0, 0, 1)"> Image: busybox4 x# n v$ |! ^ s
Image ID: docker</span>-pullable:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">busybox@sha256:afcc7f1ac1b49db317a7196c902e61c6c3c4607d63599ee1a82d702d249a0ccb</span>
0 d' i! t$ }6 o Port: <none><span style="color: rgba(0, 0, 0, 1)">
# b! H5 y+ Y* [) F Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">2 B$ y" C4 v/ K* P& {9 V" D# n
Command:* q) C8 k8 ?6 l( \ z9 l' g! C" g
</span><span style="color: rgba(0, 0, 255, 1)">sh</span>- @" S2 @$ i) |/ L% A k4 m
-<span style="color: rgba(0, 0, 0, 1)">c8 V% C X* {7 S5 d/ ]
</span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out
: A* z* X; ?/ ?% P' S9 k* {" D State: Running
) m0 |# G3 Y- a+ t% y' Q b Started: Wed, </span><span style="color: rgba(128, 0, 128, 1)">09</span> Feb <span style="color: rgba(128, 0, 128, 1)">2022</span> <span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">06</span>:<span style="color: rgba(128, 0, 128, 1)">53</span> +<span style="color: rgba(128, 0, 128, 1)">0000</span><span style="color: rgba(0, 0, 0, 1)">) U( d- k9 b4 B: a
Ready: True: A! l' V+ {$ {8 T" r8 m- I
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
* x: {: L6 i1 {* S9 Y( u% f Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
, w7 X5 J- R1 x' L Mounts:
; V- D* a5 C6 `8 P! B1 q8 s) u" c </span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw); ~9 P8 X, A! p( q& e' l) h8 W; D: V
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
# Y' S( f6 j, M, k5 C) _Conditions:
( {! e8 k6 x! m8 m8 Z2 V1 s Type Status! n6 R: y2 I; o; M
Initialized True
1 v2 I" x% ^$ R Ready True
8 c u* O1 Y) C: ]; ~ ContainersReady True2 Q. N ]/ f7 E) \ M" n
PodScheduled True M- B) f3 i3 b, Z' Z" |5 M
Volumes:* N' Z$ h% B4 y6 k8 G- E" p
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:* n- Z: y4 @( z1 O4 q
Type: EmptyDir (a temporary directory that shares a pod</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">s lifetime)</span>. ^* b1 s* T, J1 p% y* [
<span style="color: rgba(0, 0, 0, 1)"> Medium:
/ q( O+ P1 w4 W SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">2 v8 Q/ s+ ]* u3 K. C0 _$ e
default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:; j% ]) L6 p: \9 M; N/ d
Type: Secret (a volume populated by a Secret)7 Z# H: j6 P3 E' _; @
SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h% ?2 J9 R) y9 B7 d4 z3 s
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">
/ ?# g# s$ n' C! F- x, @' TQoS Class: BestEffort
D" p7 z( f/ @: i, kNode</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">5 g" t2 A' L& D+ J
Tolerations: node.kubernetes.io</span>/not-ready:NoExecute op=Exists <span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> 300s
$ N% ^; O9 p7 A f0 {% M8 V node.kubernetes.io</span>/unreachable:NoExecute op=Exists <span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> 300s+ A3 F5 B5 O5 o5 x! g
Events:
- s0 W6 p1 t. b, o Type Reason Age From Message
7 F& p5 W7 B( H </span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
/ F* u7 d, s% H* ^+ z9 M Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
! ~% B0 N; k9 i$ K: t Normal Pulled 2m22s kubelet Container image </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">172.16.194.135:5000/webapp:1.0</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> already present on machine
% f+ n6 J/ @, l3 S9 o* O Normal Created 2m21s kubelet Created container webapp/ ]9 J* C, s* Q( G
Normal Started 2m21s kubelet Started container webapp
1 L2 ^) G U/ p: N Normal Pulling 2m21s kubelet Pulling image </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">busybox</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">3 A# S% |0 z* O) l4 w
Normal Pulled 15s kubelet Successfully pulled image </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">busybox</span><span style="color: rgba(128, 0, 0, 1)">"</span> <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">14</span><span style="color: rgba(0, 0, 0, 1)">.633078305s/ D5 b3 M" x6 i! Y9 u" L4 ]& F
Normal Created 15s kubelet Created container busybox
7 A2 g8 v7 {" C/ [ Normal Started 14s kubelet Started container busybox</span></pre>2 C* l9 X$ u8 _0 P+ i
</div>0 M8 w) {4 e( d. l9 ]
<p>真的是飞一般的感觉!!!</p>
8 i+ Q# b8 j. P8 q2 n) Z<p> </p>
. w. X0 k, `! D& g8 r7 E2 v<p>三、Context和Namespace切换</p>
1 R+ t2 Z) m/ X. R! [<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>7 p* _) T' ^( K5 x; q
<p>kubectx安装</p>
$ D/ H0 I7 @2 L2 c* R/ `# P) V7 I<div class="cnblogs_code"> W5 L3 b& }: D. T6 H& A, v
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span> git clone https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">github.com/ahmetb/kubectx /opt/kubectx</span>
$ `% y# I8 P, F, ~+ `: } b+ `' yCloning into <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">/opt/kubectx</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">...
6 ~) @% K2 S. \) a; n) D! @8 Fremote: Enumerating objects: </span><span style="color: rgba(128, 0, 128, 1)">1457</span>, <span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">.
6 x; c+ k/ R f9 X% qremote: Counting objects: </span><span style="color: rgba(128, 0, 128, 1)">100</span>% (<span style="color: rgba(128, 0, 128, 1)">172</span>/<span style="color: rgba(128, 0, 128, 1)">172</span>), <span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">.# G, z7 _# Q2 p" K$ x2 \
remote: Compressing objects: </span><span style="color: rgba(128, 0, 128, 1)">100</span>% (<span style="color: rgba(128, 0, 128, 1)">115</span>/<span style="color: rgba(128, 0, 128, 1)">115</span>), <span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">.3 H0 T1 o6 k+ D4 A# i
remote: Total </span><span style="color: rgba(128, 0, 128, 1)">1457</span> (delta <span style="color: rgba(128, 0, 128, 1)">85</span>), reused <span style="color: rgba(128, 0, 128, 1)">97</span> (delta <span style="color: rgba(128, 0, 128, 1)">51</span>), pack-reused <span style="color: rgba(128, 0, 128, 1)">1285</span><span style="color: rgba(0, 0, 0, 1)">
2 Q3 X; W& z( F/ b/ c/ ZReceiving objects: </span><span style="color: rgba(128, 0, 128, 1)">100</span>% (<span style="color: rgba(128, 0, 128, 1)">1457</span>/<span style="color: rgba(128, 0, 128, 1)">1457</span>), <span style="color: rgba(128, 0, 128, 1)">905.30</span> KiB | <span style="color: rgba(128, 0, 128, 1)">69.00</span> KiB/s, <span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">.8 Z9 c. t' l/ c" [4 W
Resolving deltas: </span><span style="color: rgba(128, 0, 128, 1)">100</span>% (<span style="color: rgba(128, 0, 128, 1)">817</span>/<span style="color: rgba(128, 0, 128, 1)">817</span>), <span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">.
- b8 p+ Z- [+ ^' z4 j# d8 o9 Q$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> <span style="color: rgba(0, 0, 255, 1)">ln</span> -s /opt/kubectx/kubens /usr/local/bin/kubectl-<span style="color: rgba(0, 0, 0, 1)">ns4 i1 ^, |# ?) y
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> <span style="color: rgba(0, 0, 255, 1)">ln</span> -s /opt/kubectx/kubectx /usr/local/bin/kubectl-ctx</pre>5 v" P- M' o* o5 R f6 }% G
</div> ?* r1 ]/ W, Z3 _+ M7 n
<p>我们来看一下效果:</p>, R% q* u$ V" n! [' [
<div class="cnblogs_code">, v- n. g' [* F/ P: T' M) o+ k: O
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx
* f# X8 m/ W: c1 b+ f2 vminikube
& d( ?9 p/ K) B9 z) m$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube1 c2 B' s1 o' _
Switched to context </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">minikube</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">.0 P4 `, a/ `( ?
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
2 l- V" i8 \+ u' Z" V# Idefault
- [; u7 z \/ p" kkube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease9 C. ~4 ?1 F+ C% h
kube</span>-<span style="color: rgba(0, 0, 0, 1)">public2 f! d- e, U. w
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system8 Y1 Z3 r# b+ M
kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard- w( p. [* |4 m$ f$ y
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public' O+ Q0 Y9 _: H ?
Context </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">minikube</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> modified.
1 |) X1 o7 y# GActive namespace is </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">kube-public</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">.
{" P0 G; N2 z- X' {4 Y2 V$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default
* }3 r; r0 z% i' M& v/ Q2 \Context </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">minikube</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> modified.
6 i: e4 |; p. \8 y; N" qActive namespace is </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">default</span><span style="color: rgba(128, 0, 0, 1)">"</span>.</pre>* I! t) k$ r- f1 \' c/ q1 R2 Y
</div>( W8 x, d3 e" v% f& W0 h3 y
<p> </p>
S& k5 v o; N( _<p>四、跟踪查看多个Pod的日志</p>
2 Z5 b @ n$ y; _" f6 P<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>/ E/ Y1 f( z# f' s3 n- z$ @- D3 |! [
<ul class="list-paddingleft-2">
; P \, c a, ^2 `<li># [4 A9 C2 A: C
<p>允许使用正则表达式来选择需要查看的PodName</p>+ c% c. W( I+ n; p% O: m
</li>7 V/ c" G1 v- E' W6 f1 e
<li>
' [# g' i& p G" X* @! D<p>为不同 Pod 的日志展示不同的颜色</p>6 |" V/ e* e& e4 u7 S8 a
</li>
& }$ P; j( i. j W) \<li>
3 |7 N( g8 S) a8 ^! P<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>! }5 H6 a/ Z/ O r' B0 E# f$ y
</li>- d) O9 G6 L8 L6 _5 |- y, m
</ul>& x0 ~5 Z! P9 p2 v
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>+ j2 _# M1 T7 f. V. V
<div class="cnblogs_code">
+ c. _1 K! h/ p0 E8 e8 B) g<pre><span style="color: rgba(0, 0, 255, 1)">wget</span> https:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">github.com/wercker/stern/releases/download/1.11.0/stern_linux_amd64</span>
; b) E9 Y1 U4 {) e8 n1 ?/ m<span style="color: rgba(0, 0, 255, 1)">sudo</span> <span style="color: rgba(0, 0, 255, 1)">mv</span> stern_linux_amd64 /usr/local/bin/kubectl-<span style="color: rgba(0, 0, 255, 1)">tail</span>0 V% S; t8 [& N# L1 {& o6 s
<span style="color: rgba(0, 0, 255, 1)">sudo</span> chomd +x /usr/local/bin/kubectl-<span style="color: rgba(0, 0, 255, 1)">tail</span></pre>/ q9 y U) [: {, l8 q, [9 m9 y
</div>
& r8 P; e$ T, ~) ~+ t0 o<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>5 ]* ~, ^$ z, @6 n8 f2 N; b, Q
<div class="cnblogs_code">& f! G2 W' ~! k
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span> k <span style="color: rgba(0, 0, 255, 1)">tail</span><span style="color: rgba(0, 0, 0, 1)"> .4 i: c. O+ H# f# X4 }5 `6 A
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox' v$ X# H) Y2 C
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp; w T3 b8 X: M# f; m
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.197</span> [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] Initializing ProtocolHandler [<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">http-nio-4567</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">]
+ _3 c* C$ e5 A! Swebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
6 z( r: I6 [0 f7 n9 ]* hwebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.201</span> [INFO ] [main] [org.apache.catalina.core.StandardEngine] Starting Servlet engine: [Apache Tomcat/<span style="color: rgba(128, 0, 128, 1)">9.0</span>.<span style="color: rgba(128, 0, 128, 1)">41</span><span style="color: rgba(0, 0, 0, 1)">]7 F+ X4 ^0 M- M6 ~! v9 y0 {
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext* q" ^2 ~7 N9 S+ k" `* K
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.325</span> [INFO ] [main] [org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext] Root WebApplicationContext: initialization completed <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">2952</span><span style="color: rgba(0, 0, 0, 1)"> ms# L d% U% g1 ]" e1 z
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.801</span> [INFO ] [main] [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] Initializing ExecutorService <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">applicationTaskExecutor</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">, t; V5 Y5 [8 v2 z; f
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.264</span> [WARN ] [main] [org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration] Cannot <span style="color: rgba(0, 0, 255, 1)">find</span> template location: classpath:/templates/<span style="color: rgba(0, 0, 0, 1)"> (please add some templates or check your Thymeleaf configuration)
2 W5 q$ T, {' X: @7 j5 f' j% [webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.377</span> [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] Starting ProtocolHandler [<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">http-nio-4567</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">]6 \7 D) A0 c3 m& X% b
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.481</span> [INFO ] [main] [org.springframework.boot.web.embedded.tomcat.TomcatWebServer] Tomcat started on port(s): <span style="color: rgba(128, 0, 128, 1)">4567</span> (http) with context path <span style="color: rgba(128, 0, 0, 1)">''</span><span style="color: rgba(0, 0, 0, 1)">
, u+ v+ t: n# P0 Fwebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.509</span> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] Started TodoListApplication <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">6.235</span> seconds (JVM running <span style="color: rgba(0, 0, 255, 1)">for</span> <span style="color: rgba(128, 0, 128, 1)">8.074</span><span style="color: rgba(0, 0, 0, 1)">)) o7 A) U4 r( t# @! l' C3 f1 s
webapp webapp
5 P* V5 U- ]( O3 d! ewebapp webapp . ____ _ __ _ _
- T0 x- K/ Y; I5 q: n6 J& _3 a8 bwebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>( L* w' w0 h9 B5 y
webapp webapp ( ( )\___ | <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ | </span><span style="color: rgba(128, 0, 0, 1)">'</span>_| | <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ \/ _` | \ \ \ \</span>
8 ?5 h( V. i2 S! M. A+ }webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
a* {2 Q1 a" \1 C, n* u6 cwebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>
$ f& c4 F9 Y8 f% r, `9 ywebapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">0 K' P$ Y3 x8 [+ K! N* q
webapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)) i9 [$ l& W6 T6 H( @
webapp webapp) m5 V( E6 z3 a
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">50.124</span> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] Starting TodoListApplication v1.<span style="color: rgba(128, 0, 128, 1)">0</span>-SNAPSHOT using Java <span style="color: rgba(128, 0, 128, 1)">1.8</span>.0_111 on webapp with PID <span style="color: rgba(128, 0, 128, 1)">1</span> (/opt/soft/webapp.jar started by root <span style="color: rgba(0, 0, 255, 1)">in</span> /opt/<span style="color: rgba(0, 0, 0, 1)">soft)
3 D* I# ~9 d1 Pwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">50.165</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] No active profile set, falling back to default profiles: default
6 h1 P& z7 T$ h8 r+ Cwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.158</span> [INFO ] [main] [org.springframework.boot.web.embedded.tomcat.TomcatWebServer] Tomcat initialized with port(s): <span style="color: rgba(128, 0, 128, 1)">4567</span><span style="color: rgba(0, 0, 0, 1)"> (http)6 V/ y! a* K m* v# G f g
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.197</span> [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] Initializing ProtocolHandler [<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">http-nio-4567</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">]
8 o i5 p/ ` b( bwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
/ F( \. y; q4 w2 T% P2 Qwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.201</span> [INFO ] [main] [org.apache.catalina.core.StandardEngine] Starting Servlet engine: [Apache Tomcat/<span style="color: rgba(128, 0, 128, 1)">9.0</span>.<span style="color: rgba(128, 0, 128, 1)">41</span><span style="color: rgba(0, 0, 0, 1)">]
* l7 \- Y! j: c# k) f. ]webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext
: _, r' L: _( T9 z& {webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.325</span> [INFO ] [main] [org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext] Root WebApplicationContext: initialization completed <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">2952</span><span style="color: rgba(0, 0, 0, 1)"> ms3 B9 J9 S- D2 t1 b6 G
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.801</span> [INFO ] [main] [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] Initializing ExecutorService <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">applicationTaskExecutor</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">
5 ?8 F4 d$ }% v* vwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.264</span> [WARN ] [main] [org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration] Cannot <span style="color: rgba(0, 0, 255, 1)">find</span> template location: classpath:/templates/<span style="color: rgba(0, 0, 0, 1)"> (please add some templates or check your Thymeleaf configuration)
: E/ T' _& K: I, r3 O/ {; [5 C; [webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.377</span> [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] Starting ProtocolHandler [<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">http-nio-4567</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">]
$ Y l: G7 b, X& u) o+ Bwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.481</span> [INFO ] [main] [org.springframework.boot.web.embedded.tomcat.TomcatWebServer] Tomcat started on port(s): <span style="color: rgba(128, 0, 128, 1)">4567</span> (http) with context path <span style="color: rgba(128, 0, 0, 1)">''</span><span style="color: rgba(0, 0, 0, 1)">( [: x# U/ G3 z9 E/ P! w0 {
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.509</span> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] Started TodoListApplication <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">6.235</span> seconds (JVM running <span style="color: rgba(0, 0, 255, 1)">for</span> <span style="color: rgba(128, 0, 128, 1)">8.074</span>)</pre>& q; U' t } w9 Q" J9 @
</div>
/ v* H6 o% b, g; K( F# b<p> </p># Y: S1 r+ e$ v
|
|