|
|
- m5 V. N2 |! c6 }9 b
<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>9 h! P" _! A- k
<p> </p>: W U1 L. ?; F7 _$ l/ |
<p>一、命令自动补全</p>+ a9 o2 X, p% n& c: c- E8 }
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>) M* W! t5 u2 _% W2 j; { i
<p>1、安装auto-completion工具</p>
# ^- j* \+ [% B+ o<div class="cnblogs_code">
$ @; w1 |: m: k( H' J<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update
/ w& }4 c* h+ z5 \ U4 g8 THit:</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>
6 P+ w0 ~1 U8 x, `/ g( QHit:<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>4 R) Q7 ?3 B- f K2 \; P
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>
) a! m6 e: [) s) O# |( c+ cHit:<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>' B9 Z9 A. [ b3 L" e
Hit:<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>
0 u$ _5 `0 g) \* `6 T8 r8 G<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
3 c* j# L2 G! M4 d1 IBuilding dependency tree2 s7 _3 H5 P! B# e3 | K
Reading state information... Done$ m+ r# m0 S: t) b& b. {8 s8 |" l( t( f
</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.
/ ~ ]( r. W- T$ </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- F' ?, Z5 _! E4 s: `, X
Reading package lists... Done8 z0 z2 Q* G# {- U
Building dependency tree" o- }( U$ p3 j8 M$ X$ H
Reading state information... Done
8 Q8 m4 H2 N; a/ I6 y( z% I$ ibash</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).
7 n" E! _4 C5 ^( f; F: a</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>; ?' Z8 m+ h2 C7 {* V3 T8 [- k; A& Y" D0 ~
</div>
- r9 ~$ {2 i; [- G [<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>
7 b# e0 m! A; @" C3 ^1 B: _<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>
1 [8 g; Z7 @$ I* O2 C/ x8 G+ h" n<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>; q0 [9 T1 r6 Q" D5 `) G
<div class="cnblogs_code">
) l Y4 |1 F1 L/ Z$ p, ]<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash); z3 S2 ~! {* J3 _( [' T
</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>/ a& _9 A8 O/ G) B
</div>
% P" X( ~% C% ]4 K<p><strong>Zsh</strong>:</p>
+ V" y, h1 Q/ I- j3 w$ h<div class="cnblogs_code">) Y* q7 J, {4 S
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
4 R5 h* t t' b! j3 p9 |</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>/ c$ \- j1 E4 k
</div>7 R/ K! L; Q$ c0 m6 g
<p>配置后就可以通过Tab键自动补全命令啦!</p>6 `2 c0 t: s! _
<p> </p>, q( W9 E7 z: a( v0 ^
<p>二、配置kubectl别名</p>
! Z: f' x* e! N5 `- b& F5 Z<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
- g R( Z' P6 y/ W$ O9 k% I<div class="cnblogs_code">
1 {7 \ l$ b3 [# r8 s<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)">
( k" s& `. G( H1 c, dalias 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)">
1 K- S3 u" L0 m: Z6 D2 u: o3 qalias 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)">1 j9 f, _) l* z' U
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)"># }% q& F* a$ C+ I. F Y: ^8 L5 D4 E) ~
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)">4 d2 J3 K6 v' e; a
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)">
8 i# X3 N5 Y& |3 ]alias 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>6 _' i3 s C# }& G: k! g
</div>, |3 S* ^0 ^" _" 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>
; J' P" b+ g9 ~0 w4 Q9 e% @1 k3 i5 w<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># E" i1 w' g& n6 }* ]9 Z2 t
<div class="cnblogs_code">% b3 s3 H4 W3 w8 Y- U% P8 p. U, U
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml2 e5 K9 j" f4 g& T
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created
+ l" n. H, O3 {$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods8 W1 F* s" K+ F- ?
NAME READY STATUS RESTARTS AGE
" w% R0 K8 u4 m- @2 L0 Ewebapp </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( H4 Q' ~! u# C
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp3 M, a6 ~# s9 r1 v
Name: webapp& J# y& l$ P" g. b. q$ z
Namespace: default& U# B2 V4 M O' \5 l1 `9 `$ e! }
Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">8 h# A- q( p! G% }
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)">
, }3 e# ^5 _/ ^, `9 ]: wStart 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)">+ d; S8 x _' V! ?0 M8 _1 |" K
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp
' Z" p9 |3 `8 a* \# kAnnotations: </span><none><span style="color: rgba(0, 0, 0, 1)">5 Q0 I& m. o* G% ~/ l
Status: Running6 P/ Z, w& P' a. E6 g- k
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)">/ G( T9 S( i* t, Z: ~1 r& y
IPs:
" {- x3 \$ V2 W+ z7 A 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 E+ h8 v3 T+ ]
Containers:
9 G7 p1 W/ e4 V" ?; T. H; q webapp:1 T* h) E$ r X* k7 Y/ M
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>4 Z/ j$ [" X7 m: k& U, E9 O
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)"># l. \1 _, G; ] w
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>- L& C" g- X) j: |; z
Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP6 x1 f) e+ K: g6 p. @
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP* q3 r+ M( F3 R {7 }' x
State: Running
& S l" m9 h9 s( h 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)">
- m2 z( j6 m6 \+ P# z Ready: True% S0 f- |0 c3 e3 |2 G5 Y% J
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)"> k) n5 N7 X0 b0 f$ J
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
( t" W: t' _( m+ r Mounts:
2 \1 ^, w5 b1 ^ </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
, ~8 {5 P; w- {/ y$ q, `+ @7 t </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)( ~6 m; [- l. e/ h, l# ?& V; Y
busybox:
* v* ?" m8 r+ }5 k/ U; S$ j Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>+ b, y; _2 r5 P
<span style="color: rgba(0, 0, 0, 1)"> Image: busybox
3 k: V c) e4 V 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>9 ^( p3 |' O1 ]
Port: <none><span style="color: rgba(0, 0, 0, 1)">3 g+ \ w3 i" b7 I9 O0 a. [( i
Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">1 ~+ R5 Y5 l) S, L8 F, ~
Command:2 c7 u+ u3 O5 g' l1 U2 G; L
</span><span style="color: rgba(0, 0, 255, 1)">sh</span>; I W; q ^$ q7 J) a8 ~; Q
-<span style="color: rgba(0, 0, 0, 1)">c
* Y! T. H" {) e/ r8 {1 M2 g6 [1 p( J </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out, Q' _2 F! @1 @, n
State: Running7 C! ?& G8 E5 v4 I6 n
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)">. _( r& T* E/ I- J! [4 j$ A+ O0 y
Ready: True4 L- o& \7 E8 c( I* t* X
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
6 D. X, B. j/ e! I: `& o Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">0 m- T. f5 `1 ?5 l5 m
Mounts:
! }9 P! l. H6 y </span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
4 }0 b9 d! ?- [ |4 j </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
3 ~: y6 \5 Z3 x& g0 O+ jConditions:
) v8 R: N. [6 R5 ^+ l k! e+ j! O1 l' \ Type Status0 p& r) x$ o4 l+ Y+ d) A6 @
Initialized True/ d+ W3 X4 x) W8 ]6 q4 X) ^- c
Ready True: ], n% c$ s8 q& f! s! o6 o
ContainersReady True
5 T$ G9 X% E. t* \/ L% m" u PodScheduled True
& v7 _1 N' W% z+ i3 A) `" NVolumes:4 @3 P/ C+ j6 t& b- U/ }! i; L, E3 Y
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:$ Y, ?9 o! i: P3 I. ?9 ]' ^. i
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>
6 ]8 ^, U1 A- w; s0 o3 L! h<span style="color: rgba(0, 0, 0, 1)"> Medium:3 h+ {% K6 A" i) _7 ]) c9 a: i; p
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">. n: Z: f8 U7 E3 x8 Y
default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:
' R- |% ]5 T4 v* o* x ~, T& E Type: Secret (a volume populated by a Secret)
& k2 o+ I, |# s+ N4 u3 O9 v$ X SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h7 u2 ^4 r" l3 p& g. Z) r
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">
/ m1 L! {: p2 d( C. f, S3 eQoS Class: BestEffort
# L$ `; a' t* x- @. R' aNode</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">$ ~$ ]; C! I! N; X
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
- t k; O7 c" u 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& A, a2 L2 s- D) O! C5 h
Events:
$ e8 }1 \" h5 ` Type Reason Age From Message
6 t! W% ^7 B" o1 _3 y8 ] </span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
4 Q# I9 X1 z& a+ n Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato# u4 x( Q9 Q4 M; F* ?0 `8 \+ y8 u
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
' s, i5 b9 i4 }) v# k Normal Created 2m21s kubelet Created container webapp
! a7 a5 K. f9 |: _ Normal Started 2m21s kubelet Started container webapp
) A* `" x9 Q4 d9 i$ { 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)">0 i! E! I* e" K% H$ ?# 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
% h2 s1 }* w5 z! q Normal Created 15s kubelet Created container busybox
6 t1 G7 _4 @ b7 A, q Normal Started 14s kubelet Started container busybox</span></pre>
! P) B4 s# _1 _' ^</div>
- A( _ O/ F9 D* M- {<p>真的是飞一般的感觉!!!</p>
: ?/ u: Z& ~! T* v' b# Q2 J9 C<p> </p>
/ u2 Z" B6 a% f& r6 ]<p>三、Context和Namespace切换</p>0 S4 `! g* O u# q3 k) b1 [% `& ?
<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>
b8 H3 Z% N* C4 \* u& h$ p<p>kubectx安装</p>7 \0 R0 }! k8 E9 v
<div class="cnblogs_code">. h7 j6 v) v p, \, {3 @
<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>
" g& g2 h; Y& i) D( P& TCloning 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)">...9 T2 s7 K+ p" h. y
remote: 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)">.
2 p: L T2 G- P7 W; B# ^remote: 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)">.* a) e, Y* Q7 w3 u
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)">.8 c0 |6 ~& r, V$ k* g% F3 ]" s* C
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)">5 a: Z; n- l: @
Receiving 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)">.+ m# \% B2 d) z3 F+ C5 H$ X: M3 i
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)">., R( l4 ~ o: f. Z4 r
$ </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)">ns
; Z3 R" D. D/ I$ </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>1 V5 B- b% N: l1 \7 Z
</div>
" W. J4 y8 ~, @1 K. P2 D<p>我们来看一下效果:</p>/ v% i1 W( q* ^) Q
<div class="cnblogs_code">
- s' |& ?8 O1 e4 ]. o<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx5 v) U) x* _) N7 u/ D' I
minikube, u. Z: E/ U; J8 ~
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube6 E3 g G5 c% ^* |& B" V
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)">.( \5 @9 G: N+ r/ i: }# G* g
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
/ P' A9 ]9 c8 B6 m2 Tdefault
7 R$ ]7 x6 l' X: R9 _kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease2 ] F, T o' X, X( _+ Y. W8 z
kube</span>-<span style="color: rgba(0, 0, 0, 1)">public
6 G# g: H! n6 |& Y2 pkube</span>-<span style="color: rgba(0, 0, 0, 1)">system: D4 h( g* ~3 S3 R! p8 {
kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard: X+ s% h. m1 ]. a
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public
% d- V; ]% e, T/ e: m% b6 QContext </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.& k8 `* o- @9 \3 ]8 S' H$ m
Active 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)">.- R" w0 m; n; W i+ e
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default
/ i5 T/ ]7 J5 {! D# v' aContext </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.
) v- F+ g. v/ d: w4 p" L$ S, HActive 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>: e! F; {+ ]% x) y) s0 t) Z% ~
</div>" |; T0 ^0 X! u- a8 M8 Q, z* [* T
<p> </p>
% T: |+ @7 x. v<p>四、跟踪查看多个Pod的日志</p>
l. |. S$ f% R* u5 R! _' [<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
, ~4 B" ^1 E- h* e<ul class="list-paddingleft-2">* c- S6 m5 K1 j, q/ k
<li>
2 j6 n4 Q8 m3 I* Y4 }1 H8 P<p>允许使用正则表达式来选择需要查看的PodName</p>9 s( H4 j/ _1 o y
</li>
4 @: C7 L% k# A# g<li>
0 u% R1 G8 {. p9 i2 D: e2 o<p>为不同 Pod 的日志展示不同的颜色</p>
% B0 C5 ?( L: f( S/ ?</li>
( r) U! H3 f& L& f+ E<li>0 O9 s0 a2 ^9 O# ?8 y* i
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>% @6 y. t7 v1 t
</li>5 f7 `1 Q3 `" Y' r0 A1 d U7 G
</ul>
. P7 U; L2 V. y$ M<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>4 L3 R& N; z9 i- k/ J1 c+ `
<div class="cnblogs_code">7 t( Q* S% Q- i m" e/ Y% r
<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>% `1 r2 e0 C( ?* {
<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>
1 S: r, y: k5 N2 u$ R0 F6 M3 y<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>0 r8 Z g9 c8 a6 M1 b
</div>! V0 b" E7 P' B5 E2 b4 n
<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>
5 a8 @; \* T* q5 p3 n<div class="cnblogs_code">7 \# V4 N" h: P- G+ a
<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)"> .; @2 Q9 R* n5 @6 B3 U$ y
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
( G# w9 ^7 C- V. P9 g \</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp
8 D8 z. V: Y! B2 [+ Z4 |, ?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)">]. `9 W J8 |" e: H$ R8 U/ S
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.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
; u/ q4 n) A; C8 B2 Mwebapp 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)">]% Z6 r# Q7 x+ z/ B) c7 m4 ]1 N& Y
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 WebApplicationContext0 X3 [+ ?) V+ J1 H6 P; t
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
3 W* f/ G* q" a$ |5 T& P, |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)">
/ j3 K. ]7 h- mwebapp 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)1 N- O3 G4 F1 N$ i
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)">]
( g1 J: E n6 g3 G; J& 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)">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)">
7 Q! j0 L; M7 h/ {- A* j9 h" wwebapp 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)">)1 w8 C% L3 H) V: Y& A7 M
webapp webapp
! m0 k$ G5 F/ D7 c" U8 }webapp webapp . ____ _ __ _ _
! `" a2 }. ]2 G* jwebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>) m* Z3 q& V6 r& p
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>' i7 m& Q1 W5 o! P
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
- z# |( D: A# R% y9 ?9 rwebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>
, [* L' U; ^' z7 A/ `$ [webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">6 q. X% W' _3 s9 a% Y' [
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)">)
. `5 i( C5 n% w* p+ s, k, a. r$ Pwebapp webapp
! u2 Q& d# G% y; ]2 rwebapp 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)
# Z# j y0 \+ [7 [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.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: default4 p/ x; _2 Z' M1 \& \
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.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)3 @" o' p) } l% d. S: o
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)">]! a: e' H' V9 y- O6 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)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
! d, N% f" L$ F6 ywebapp 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)">]
8 l# x5 E6 J$ o# \0 i$ Rwebapp 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
- K: Y) T: y/ K/ K1 k: ?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)"> ms5 b2 h; w9 g! j% b7 f) t1 E1 W
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)">! R G* y( C, A* 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)">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)8 u- d/ z9 B( `, O1 o& 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)">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)">]* Z6 I) A' i% d
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.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)">
& h8 m# p6 [3 o9 q' a, m7 }+ ]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>
" K( r3 ]4 W' b</div># t: m) P# D0 }- e) y2 s# w( } ~
<p> </p>
$ v. j$ F! h1 G# e( e |
|