|
7 f5 W, I% f# j<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>
; i1 B( Q7 {+ v f# P/ d<p> </p>8 ?$ [, `1 D& i: N
<p>一、命令自动补全</p># t9 r! w9 a6 D0 j! y" P' R
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>
1 `5 l, a+ z x( c, R8 r<p>1、安装auto-completion工具</p>% |0 Q" O) P3 M3 L$ b
<div class="cnblogs_code">8 i* T0 |8 t- P+ h3 N% u% W
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update' }6 R9 O B6 r: A: l
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>
# b: r/ X0 l; f/ ~) D/ M! cHit:<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>5 G' H2 D2 w {( h& [
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>
' K% G) Z& v% Z( C7 ]* SHit:<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>" j }. R/ p9 _# y. [( ~
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>
7 r& Y7 z. n: `9 ?<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done3 J G8 S: w' O. \3 K4 A4 n8 A
Building dependency tree
1 l8 Y# J7 A0 `; N* l- N2 ?) ZReading state information... Done
/ `) E" [/ G6 z U, k" N</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.
6 k! G$ ^: c4 D! W5 @$ </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)">completion3 X- }& i+ N$ T5 X
Reading package lists... Done2 K6 v! q. Y% @% q- S9 \, r
Building dependency tree
# L, I D8 a) JReading state information... Done
! Q* t5 A& C! Tbash</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).
6 c7 _+ ^% T: 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>
) _- H/ I- P3 }</div>
' e; ?4 E9 o* ~" B" U<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>
: W: h' W+ K, ^& D! a6 N P/ T<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 f+ |, \% u) R. t- z<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>
/ l& H, g+ @7 L# d3 d: _<div class="cnblogs_code">
% E5 S' z, ]5 N1 x6 K A Q<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)6 d; C/ l5 `6 L
</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>7 `( k. i$ O& L2 i
</div>, z9 g) ~% \ n; x q; Z$ @
<p><strong>Zsh</strong>:</p>
6 D9 u/ U& h$ L$ O) e# Y3 S& l<div class="cnblogs_code">
& J' `6 B2 A& N2 H<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)* Y1 Q3 n C: w; g( q# U
</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>
! W& b2 Q- B( a/ A& ~8 z</div>3 G x: N" u# b! o2 l
<p>配置后就可以通过Tab键自动补全命令啦!</p>+ z/ z6 z5 ^( v$ c& D% |3 {
<p> </p>
& r4 W, V- v9 [; j<p>二、配置kubectl别名</p>! u' a* a6 _: H; r1 a
<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
: G; n$ \+ H* ], g( m' Q<div class="cnblogs_code">8 K6 }* }/ i/ ]
<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)">9 i2 v D0 d2 k0 H
alias 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)">
, }) I2 ~1 j6 d) `' N9 }1 ]* ]alias 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)">* a {1 v2 {" a& w5 N' }
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)">
+ \4 C# G' e' j- p9 yalias 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)">
- `+ w7 M$ [5 d3 I( O( I# Palias 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)">
3 L x) a @6 P5 ^) f* o; T# v8 X5 Lalias 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>1 {9 e6 H @% {9 N8 a8 R0 Y; ~$ E) u
</div>% s3 |) B, c) e6 o- i
<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>
" Q! w: U- @7 t3 `8 n1 Y) j7 x0 m<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' l3 e$ d2 j, J- o* d5 z3 @<div class="cnblogs_code">
) M/ d9 r5 ^( f% M5 A# b {<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml
' M/ ?: V# O3 Epod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created. a8 v: X$ u- ~2 d* R: `
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods
6 x% ^$ r. _; T2 }$ INAME READY STATUS RESTARTS AGE
% S9 B3 A$ t4 ]" a: K, twebapp </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)"> 7s3 O, \2 ~( j& i- d/ r7 U( v
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
( G* J7 Y" R+ ?8 p- a3 |2 VName: webapp0 u/ O; Z4 ?5 S; v! @" D+ V
Namespace: default
' ~0 B/ o! F5 dPriority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
; c+ B$ A) k0 l+ v' U# G7 wNode: 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)"># C" m" j8 X( M7 I& e+ N
Start 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)">% Y4 F, l! H. }
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp- y' O- t$ e: Q( K" b# g* }# Y# Q& @
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">
$ t( W! R# Q) \0 V2 \: A2 vStatus: Running+ k/ \( Q7 V" A0 T! P
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)">3 P0 T/ a7 h* p- q5 S$ m/ _
IPs:' r" R$ `& _0 z+ o: Y# b5 [
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)">$ a# b8 A- K1 |9 ~* n$ g
Containers:
: C& d8 a' X* D3 q webapp:
6 T2 @) x$ L' i" W Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>$ G/ F" e3 G: |5 ?% t7 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)">
, F% v; `# c4 S) W! ?. g 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>2 x! E, _8 _( u# |/ q
Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
. q/ w) j1 ]1 Y9 a Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
3 P5 y, {- f! g( u- l" I State: Running
2 T9 l% g/ e; p) k4 C) R/ e 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)">
2 {: s7 I; Q7 m/ w3 |8 D9 u) L Ready: True4 R7 s* Y1 N8 K) F7 c
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">/ `. D) ^$ G- Y0 [& T
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">0 t' W# g" o0 O7 ?7 a: C- l
Mounts:
# d; k. E3 M4 s2 X! y6 p4 M% _ </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
3 u2 ]. P' \5 \% I$ ~* g: b </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
7 l2 ? d0 G8 N" @+ B busybox:
p0 m; _' W4 x; T' W/ I$ }4 E, d Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
! [. O2 ~0 W" D" q- o<span style="color: rgba(0, 0, 0, 1)"> Image: busybox# B( I/ _) z5 `. s0 h
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>! k5 Y9 y; U: s8 ]; g
Port: <none><span style="color: rgba(0, 0, 0, 1)">
2 W* n ~8 q2 j Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">" J* v- c& r/ Q: V# F
Command:
" p! x' g2 v/ [& L </span><span style="color: rgba(0, 0, 255, 1)">sh</span>
, \! y. [' P$ B5 w' i1 x' _( o- P -<span style="color: rgba(0, 0, 0, 1)">c
$ q( j5 |; b; k </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out2 w2 _: I3 A3 o# b
State: Running# B/ [3 {7 ?6 |2 y. J* ]( s4 ?
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)">
- _% ~7 }' ]; m9 W Ready: True
l! ~0 H( @; t: G* a1 m9 ? Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">3 I$ p. c" M% _; x' J
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">$ i" D+ R4 [: A# o! r& y) \! d+ N
Mounts:7 V$ b* i7 ~$ ~3 J
</span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
9 W6 b4 U# k- B2 _8 Q </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)% O, {6 e; x, {* ~0 B5 V# X
Conditions:8 t! m7 T8 r: V" z9 H: v
Type Status: P' _ U/ i2 c1 d; S0 A& u) z. a
Initialized True
0 a% V) E4 {/ w" p Ready True
6 m' C/ r. K" t# R% m! k! f% Q/ y ContainersReady True
' O; I8 N9 ~& W2 s7 b! \$ f& W PodScheduled True
% Z8 E/ |% d. N4 L1 x. `* KVolumes:
0 f2 T. l! m, Y+ V! i webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:
& y% v3 |- r0 s" p9 ]( x* M9 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 a0 O, ?. K8 n0 X. C<span style="color: rgba(0, 0, 0, 1)"> Medium: s5 m l% p& c" ~ c+ w
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
5 f, i1 ^0 Y- L1 M5 ] default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:2 l4 l, e( f; k0 x) V5 g: |' }
Type: Secret (a volume populated by a Secret)+ B- [( S% u3 H6 g: A
SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h
2 m( E; I( g9 x k. e1 c Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">
/ t% y' L! [3 k+ vQoS Class: BestEffort
5 B$ b* n) B: b9 [# P' w$ q- k# x! J7 w7 GNode</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">) {; F3 i4 ?& r1 z5 e' V: e. }
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' Q+ F( D& x* j$ s& S9 }
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
; _ L& b2 T. Q8 L# z6 M0 ^Events:* A$ Q8 e* ^( |' q4 [% A
Type Reason Age From Message
4 _; {7 R$ z1 F+ v/ B </span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
6 {5 S" Q: t2 _; G& |( Z7 q Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
6 L" I2 D- a9 ^2 q 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& _" A, L0 A8 t3 {# t: i
Normal Created 2m21s kubelet Created container webapp% E( R0 a+ d# @, a" o
Normal Started 2m21s kubelet Started container webapp ?: o4 C0 d/ J* b2 `* N. m
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)">' _1 ` u7 ^& V' N$ t
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)">.633078305s6 o" ~/ U# x0 B9 Q7 }
Normal Created 15s kubelet Created container busybox
- h6 \/ w$ q7 } Normal Started 14s kubelet Started container busybox</span></pre>3 m5 r' u' K. r) A3 a& o
</div>$ {( V6 R4 H. F! R; [2 u8 {. T
<p>真的是飞一般的感觉!!!</p>
- O' f; t+ F7 l0 S& f: i$ Y7 @<p> </p>
8 k1 Y% I* w' c' ~. ~6 P# J<p>三、Context和Namespace切换</p>' s, |8 f$ T! {
<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>
8 i8 p+ A- M) I! I9 y% X& t) }<p>kubectx安装</p>
2 C( F! F4 e2 z0 n<div class="cnblogs_code">% f6 b( l9 l& x
<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>3 I' J6 U# A1 Y
Cloning 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)">...* |; I% e, @! A# M% L
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)">.+ B2 j6 s; Z6 Q; {* U
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)">.
! `) x: }! A/ ~! u9 Uremote: 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)">.
* N1 J+ m7 \! Bremote: 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)">
8 U$ X, L4 a/ H1 }) dReceiving 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)">.4 ]$ p# T. I1 @) t
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)">.
0 y! I5 Z" t2 ^: x# N+ z4 m, y5 |$ </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
# ]) H5 j( l5 }1 d" s$ </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>3 s4 i" q- o/ B- T- s1 @" ?6 G ?
</div>
: _9 G9 x5 Y2 ?8 m4 g! w0 q<p>我们来看一下效果:</p>
6 t( F# Y7 B* J7 G9 Q; ]<div class="cnblogs_code">. ?2 g p8 S% o* ?+ ?
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx( C e, O" Z# p3 W
minikube {1 ~5 `: @& d& m7 i$ L
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube
8 C2 `6 u* q. r z5 g1 ]+ `0 _& {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)">.
6 D, O1 h% ]& v c# a' u$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
- R. }, S& p7 Z0 S, _7 ]default. [9 n+ \6 R6 M- i1 F s( E
kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease
0 y& P2 W8 ~+ jkube</span>-<span style="color: rgba(0, 0, 0, 1)">public* M% b1 J# [& e8 R/ k& j' q, w
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system' N+ Y+ S# q, K# z5 f8 d: t
kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
# b8 \" b! W6 x6 ^0 E$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public
# b$ ]8 a5 {& \6 C: ~' a- rContext </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.
w' ~# D& c! L6 X% |( qActive 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)">.% N+ a9 }. @, \: z
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default
# ~5 z% p3 S* G# d! W1 q. i0 HContext </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.+ t; I& B! r( b; C
Active 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>$ E5 `! P- p$ j/ \, a# H
</div>
. R7 L& a9 g B% V' L<p> </p>
# [, u5 u& ]' O( |, R<p>四、跟踪查看多个Pod的日志</p>
' F9 |7 v6 O+ D4 J* D+ J- X<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
/ `. L$ T% b. ?+ ^; F8 j* v<ul class="list-paddingleft-2"># a. r3 n# z% O3 r
<li>- C9 H* Y4 l$ k& H/ V
<p>允许使用正则表达式来选择需要查看的PodName</p>
6 W7 t0 p k6 j2 E</li>
! S) U; t8 Y) U* c6 O<li>
' ^9 A6 A' b# v( H3 e; O$ R<p>为不同 Pod 的日志展示不同的颜色</p>: J1 Q w: N" o6 V* G
</li>
& ?4 E+ d/ }" z5 m0 F5 O! m- o<li>9 `3 E$ ^) a- k, w! h( {
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>4 t3 G- v6 d: h" n+ O- v, b2 W- W
</li>
" r' G" [7 e% {: h! u) ^6 X1 P</ul>
+ ?: p7 u, R7 w) a, d<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>- B& `. I. W& r8 X3 j/ O
<div class="cnblogs_code">
$ {3 M* v* T; G# V! _<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>
$ p3 n5 E5 q) Q1 L ~<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>
$ ~9 F) |' y: b8 q<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>+ i. I1 t& f B3 } y
</div>. @; i% z: z! \1 \( \ _+ @
<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>: F% c) P3 C; A* x
<div class="cnblogs_code">
' _. Q) c R7 p: D<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)"> .# S/ v$ M* e" `- u& N8 ?. s
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox* w0 P0 ~8 k' K9 J) d5 E, o
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp& V/ P5 q+ s+ A4 s$ H" 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.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)">]
& M2 i# W( y- Z7 N* X. r. u2 P: 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]
3 U5 v* T# h0 Y. p- Qwebapp 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)">]* s2 E. K3 I$ D2 h
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
4 A( s% D! n: U' [% q6 Q, I/ T" Nwebapp 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
5 r- c0 D1 e$ X2 M5 u8 }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)">; s2 u. y- n0 M' S# m/ u
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)4 A0 V% v+ w6 _2 t5 j9 Q8 x: 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)">]7 }" u2 n9 I8 E* @# b% g7 @
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)">
7 D$ z6 L' H) R9 Qwebapp 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)">)9 A' y( ?; n6 {9 }0 p* u
webapp webapp
( u7 B1 M) M: |webapp webapp . ____ _ __ _ _
" N: U" u% A. j8 i9 u3 b1 ywebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>) W* i: L2 t8 \; k, }9 _
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>
) d0 f: |, M$ i! o7 u) Awebapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )* P& W7 F7 D5 I2 m; k! c
webapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>
2 d; v& q) s- T- _( H( ]5 bwebapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
0 I" `* p. a+ X" D6 a' iwebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)
0 ~# T8 }9 `8 e# o* O& ], n+ M9 q& Ywebapp webapp3 o- U, X2 W; e* m( x9 v) 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)">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)
% T9 ?% ]" b+ K+ I+ `2 Dwebapp 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: default6 q* ^2 R" _' C1 R0 m9 ?
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)8 u, B7 a. e. P0 _
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)">]
, \& h3 B$ v( I$ w/ ~7 awebapp 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]
& @( V. Y4 q0 Q0 w1 y5 ?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.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)">]
% T* S* c( r/ a, awebapp 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
/ f# E" a s, 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.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$ g; s/ g! {/ N9 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)">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)">
2 q6 \) f# U9 z1 u1 I+ iwebapp 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)/ q' m' q0 q" J
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)">]
% ^) _5 X- I+ p Owebapp 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)">
6 R, F: ~' e1 e3 e' 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.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>6 z3 A" h1 l$ ^& k$ \0 K9 {3 a
</div>' [4 T7 m( e9 N( B% P0 B
<p> </p>
" l; h6 t9 l) r0 I* R# o) d |
|