|
|
" N2 n& O. O' Q& B7 P<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>/ m7 \! h/ r& ?, i5 U
<p> </p>) q) N4 i" Q6 @, F; c0 ~
<p>一、命令自动补全</p> _4 p% k& w' ^8 U; r; ~
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p> X& C9 Q9 O1 ~
<p>1、安装auto-completion工具</p>; i! W" @: \7 c" S" g+ Z0 r
<div class="cnblogs_code">
4 ]: g% O1 l7 c: U3 h1 I* [<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update2 O, @: Y3 C; h4 j- o
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>1 X2 E3 s3 j* f9 v, 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 D5 o3 y, g# q$ m9 F6 w" A uHit:<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>0 z; {- i g6 A* @* y) n* l
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>' a, J& c6 I+ I% H% G7 R! ?
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>) E6 l4 S, H& P% D( m/ A' `
<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
: x0 l1 s& x3 p* SBuilding dependency tree5 u' b d l+ x4 X
Reading state information... Done$ y) H+ U6 a: `# J. E
</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.
# z: O4 p0 A5 M* U% a H N+ a$ </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)">completion4 v3 O# J" Z% t' d
Reading package lists... Done* h) S6 U( }# K' p3 W
Building dependency tree
) W! j- n7 b. ^0 ^" u1 ~0 Z5 ZReading state information... Done
0 C! a' O( F" U' k* lbash</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)., [; K) W; H" U* f- R% n# Z$ r9 i
</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>
$ _" G# Z: d: X</div>
6 E& |* \8 w2 T2 ^( }<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>) W4 E; ?4 B. E8 K5 s
<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>3 ]! H1 V# J3 H& {! C9 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>$ B# H. i; u( \! Y% O: ]% T
<div class="cnblogs_code">
; i* p; V. w r6 G) ~: C+ w0 N& W; N<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)* z) L! A+ P3 L2 Z1 J7 ^
</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>
- B8 l' h) ^, ]; {* ^" v- q, P</div>/ @& d1 l" A0 O
<p><strong>Zsh</strong>:</p>
" ~- w! C* {& t8 |# {4 O<div class="cnblogs_code">
" Y( Y8 @: J' r8 E- }<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
2 l+ }- j" m! h: r! 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>/ e7 T0 w5 q2 q! R% H1 T8 T
</div>, }% w: v* B6 H T
<p>配置后就可以通过Tab键自动补全命令啦!</p>
h, c0 z1 j* a" ^+ g- `/ r. q: O<p> </p>
H% c$ I$ Q1 T$ E1 o<p>二、配置kubectl别名</p>
1 B1 K# t: Q. w7 c0 o# [( m<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
$ |& k t* g2 O" B' e4 N( y<div class="cnblogs_code">6 K- a$ R! q6 f2 l3 B
<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 {8 a$ Q4 r" ?( v/ zalias 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)">
% c! h% T3 p. C4 o$ M2 @. z. |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)">
6 ] J# Q8 M/ f# g* f2 {6 _$ ^+ b; `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: z, r7 s7 `. q! V6 V, s2 ralias 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)"># C* P W0 v; g+ R( H- t; n
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)">
6 M- } y: e3 H2 Balias 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>
) V; z% b0 B$ d6 V3 s2 ?</div> ]8 I) K& @) t/ h S
<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>
* L" {) X' m6 @6 U# R9 f; c<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>
3 i5 U8 l$ x5 Q<div class="cnblogs_code">
( s) W" n0 R& k<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml8 o3 q1 m# ]. T5 O& k. _9 I
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created" i) f! ^1 b% g6 J$ ]* D
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods0 b( t- c# P5 T% d! K6 E; S
NAME READY STATUS RESTARTS AGE
7 R$ M# A& I4 x. mwebapp </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* V5 Q, a, {7 t
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp! r( V6 }8 v% d, D( d7 A
Name: webapp! B. f. m$ o I( \* H
Namespace: default" p0 ^* G0 i0 `4 m! F
Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
m7 J& a4 i! U+ 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)">
0 i9 M P# |5 C0 i* N" T2 i* R0 |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)">. b& n1 a/ S( }$ v
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp
4 M, O# q# z( MAnnotations: </span><none><span style="color: rgba(0, 0, 0, 1)">
& n( m% k. |8 {) i( l+ O" x/ b2 kStatus: Running2 N/ v0 t3 s+ ?( f
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)">) A2 | L, y7 {( R- t" T1 q! D
IPs:+ J- A6 m) X9 i' S! `* m5 {* c, r
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 f: N% B6 { p, w- J2 Z: m6 Z' d7 ]- c
Containers:7 ]' I8 j3 W: ^' g8 B! Y z T
webapp:
. W. f# E- R. e& v$ \; ] Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>
y1 S9 @) P X/ a3 Y" d 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)">; B+ v1 U0 O' Y% Y6 C3 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>
6 g Y0 S. V* x Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP1 [- z8 w# U9 A& p1 O/ r9 x) ~
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
8 \6 n' o1 H0 r# a8 ]( O5 Z State: Running
/ o+ Y1 I2 E- M, t3 X 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)">
6 H* W' ~& a2 C8 ^ Ready: True
6 {8 d5 e' z6 [9 V0 g( e+ D Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
0 }9 a9 t* F' y Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
$ p! a5 ?+ k* I" P Mounts:
7 X8 c( y D) v" p3 u- H </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)5 t/ T ~1 ~7 r5 K
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
3 n2 z+ r% [ z/ P, l q& m busybox:( ]) v G% }7 X+ e: y- x' l5 U# ~3 z# ^
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
" ^2 }5 Y C# }2 D, P4 K<span style="color: rgba(0, 0, 0, 1)"> Image: busybox3 i4 v' @% K# M E/ P3 B
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 B) F; m9 Z, U& G# M4 w Port: <none><span style="color: rgba(0, 0, 0, 1)">
4 J! B- D( M) u% x) c8 b! B( d* f Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">. P B0 t& O" n& P) W
Command:
. g; S% K8 H; ~1 b# x- J </span><span style="color: rgba(0, 0, 255, 1)">sh</span>
: T$ g/ Q8 f6 M! a0 B -<span style="color: rgba(0, 0, 0, 1)">c5 ~5 L9 n6 W5 C' i
</span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out
2 P4 i+ @9 |7 F5 _# A State: Running
' U3 P, Q4 I4 w' U 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)">
, B. z: x3 b6 Q3 G& i. H8 y Ready: True
/ h6 ^2 t# { o& N/ ?8 p Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">% r+ N6 f; J/ B3 D) b- u
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">! q4 B6 ~3 E% f$ O
Mounts:
4 x5 E3 U' V3 v6 k( R </span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
# B/ \% B* M9 C7 z1 l" [: ] </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
4 ?2 J+ r% E' t& ]2 l% kConditions:4 r S5 H1 h5 |6 H, b' U0 A
Type Status" Y0 ?& V$ Q% L; n
Initialized True
. T0 s$ ^' G/ l Ready True! b1 y& ?/ J- p& r
ContainersReady True
+ a7 e8 F. w4 K s3 ^$ h PodScheduled True
* l# [: @! w2 I/ B) s/ M4 r2 s5 P$ `Volumes:/ M n. n8 e$ A3 M% S; q; h
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:, J4 `, s3 L+ q" U' Q: E
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>, m/ |. H9 \/ `5 D* n
<span style="color: rgba(0, 0, 0, 1)"> Medium:
" x5 J/ t$ ^8 M. L6 }4 Q" b/ w SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">4 \2 y% q: m( ]5 W) W
default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:) R0 W; @. v' R5 ^4 x4 m, s8 u
Type: Secret (a volume populated by a Secret)
( y& V- @4 Z( }2 p SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h6 l. L* P# Z/ t4 m' v3 U3 q- t
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">- s7 z. y3 P& h/ y( t( V
QoS Class: BestEffort% R) z; F8 p# q) J) s9 F+ P) w
Node</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">' x7 [: s2 }0 g* _# U
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
! Y9 n' {6 f @1 G& g 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# f, K/ A4 I6 }+ @$ f4 T
Events:' u9 a4 R& G: [! ^6 u
Type Reason Age From Message
1 Y* D% O0 O! d% t* T) c5 L3 Z </span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
' r/ h4 P9 A5 j- o& s r Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
' ]! Q4 ?" F: c8 j7 _* U) ? j 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
2 y9 o& L8 ?2 e& D7 p( R* m Normal Created 2m21s kubelet Created container webapp% ]7 h3 A7 u9 ]
Normal Started 2m21s kubelet Started container webapp
- r! v) ~5 @2 o( \, d( ]3 ^ 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)">; j G) ]3 i/ k9 P4 s
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)">.633078305s2 S& N( a; o. S" x! E) T- h( e
Normal Created 15s kubelet Created container busybox
- K3 ], o! Y! H5 i Normal Started 14s kubelet Started container busybox</span></pre>
+ E- K. d7 T" Y2 x" _% T" E</div>
2 K- J; z0 K5 [' w& i* t<p>真的是飞一般的感觉!!!</p>
* J- Q( j& n8 p2 s5 L3 p* l0 z<p> </p># Z* x' t: [2 m# q% A% Q3 r, D
<p>三、Context和Namespace切换</p>
+ d$ S4 y1 B- Z1 D<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>
* U1 o Q: p8 z9 k/ X/ M<p>kubectx安装</p>
0 O; Z4 i. \. F# n, j3 u0 J<div class="cnblogs_code">) k: ^8 S( O8 P" \. m; W6 S) p
<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>: U( t- H9 u: \7 J2 m& I, T" J& g
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)">...
8 a* _ C4 K& V! D; T- bremote: 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)">." O- t( C1 Z- I2 O) M
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)">.
6 v! |" P$ P9 z+ U) i* V+ 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)">.- E8 L3 d% D2 R5 g* o
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)">) g* p0 J) q$ k
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)">.
( v8 [' U- f4 i3 Q4 OResolving 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)">.
% j7 Q0 H7 w+ h: B5 w$ </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)">ns0 J) S$ t r& o, t
$ </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>& z' G; P% G1 {
</div>' e0 u9 ?2 H2 Z% [
<p>我们来看一下效果:</p>
. f' {0 G8 p/ I5 a" y$ _2 ~2 K<div class="cnblogs_code">
8 B4 c. B; D7 S% O$ o9 i9 K<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx2 x p) i% i% z0 X; G" J
minikube
1 L8 ~1 k/ ], W% f$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube
- u- G, v3 X; p! F9 dSwitched 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)">.
, Z5 O& |7 S4 M1 P; w$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns% T, J: h3 P) e2 u7 ]
default2 w( k. T2 ^$ U
kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease
1 ]0 Z& A/ D, qkube</span>-<span style="color: rgba(0, 0, 0, 1)">public
/ s& f: V( U9 I6 b2 a9 C Q6 Ikube</span>-<span style="color: rgba(0, 0, 0, 1)">system
5 _( [* b4 Z# B2 E( [' E; A0 skubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard9 A* A9 Z5 [" P- m( ^3 {6 P. D) J9 R
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public) E) T! _6 i. `
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 [* v& M' i) sActive 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)">.
. q" u, [, }7 U& e% s$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default3 V W0 [+ B- D3 j2 R5 R: B
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.
/ o$ k! o( ]$ g4 W: GActive 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>4 |9 O* w1 `( }
</div>
) J" i {) Y; `* ~' ~6 S<p> </p>
( [5 ~6 x e7 U/ M& T* T' w<p>四、跟踪查看多个Pod的日志</p>
3 o$ n2 Q# k& R/ q3 S! C<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
: Q3 M! j4 e% F j+ o<ul class="list-paddingleft-2">. Y# P. z7 z4 C: m e
<li>
- E( i* K' k0 Y9 R<p>允许使用正则表达式来选择需要查看的PodName</p>; a( Y0 w- R4 ?/ }/ s
</li>
: b. |# l7 c$ d6 {% j9 W# A3 ?7 k, w<li>. [) n9 N& [4 Y( `, V# x. T1 L' B) `
<p>为不同 Pod 的日志展示不同的颜色</p>3 \) B1 y- O5 k- h0 l& t- _
</li># i( ]9 L( |6 H1 y: L- k
<li>3 m2 B u0 f+ L t4 _
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>
! K" Q& k1 w `% |5 S</li>& p$ i# l9 |4 \8 F1 \+ n
</ul>; [4 l/ I% \+ F3 F* s' ~& \5 ~
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>
2 ^* I g& h9 t* M; r# r" r<div class="cnblogs_code">
/ l: O; z" J8 d9 x% s+ J<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>
4 z7 x( j7 \% k<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>
N" t- X S' y/ s4 s1 T<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>
; K$ ^3 D- S: u K ^3 A2 o% k</div>
& B4 g7 o1 f6 [<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>' N. P" R. ]0 D+ P4 X
<div class="cnblogs_code">
9 x# K P8 z3 j# [/ 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)"> .
6 X( e0 E4 D" h }. \</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
) X5 l% I0 _. r1 y</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp3 m. c4 d @# }3 ~7 H# q" O) ~7 J" ^' 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.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)">]* H* \ `: u N7 `# G
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]4 o; ^7 L1 a( O& B 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)">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)">]2 L9 Q y. O8 B1 V
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' ~( V2 n5 @) o# v; m7 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)">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
4 f: R: j b! M5 c& }, O, U; I6 J# Pwebapp 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)">. u2 d8 p& D( e b4 L0 l' D
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)& E% F4 N7 X; E
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)">]
- z. u4 H: V+ h# a3 ^0 Xwebapp 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)">
. n z# z# e& O: q0 ]( Pwebapp 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)">). t9 B& B7 D1 R% X' R" `8 [# i* Z/ |
webapp webapp8 W) _& \3 z! t! Z2 f% z
webapp webapp . ____ _ __ _ _* o6 F7 t0 j! a% C4 F
webapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>
1 D! |; b, `, t; K! gwebapp 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>: A) o4 O7 w( [! s" g
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
- z+ i6 Q5 m' s8 awebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>
0 u' F. b8 @* [* K# Z: \webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
4 i+ J( K: i: O! L7 Wwebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)
8 A6 U; t) n2 I) dwebapp webapp
3 \' w8 e" Z" H4 w1 F7 kwebapp 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) e R6 B5 ~6 c* W2 L9 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)">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) m" j' _& c6 g. X
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 @- w' b- _( C/ k G/ Gwebapp 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)">]
; B, ^/ I9 f7 U* N. ~6 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)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]2 O7 W; ]" z' l8 x) {
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)">]6 A: t7 ~& ~0 t: i! q1 N% o" A/ q
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 WebApplicationContext4 j. Q. J" H# l
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 f* O6 ]% H3 K$ Q0 e6 x2 U
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 _+ Z' ~% J1 l4 q( B
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 H& U! O) ]! m! d' O R1 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)">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)">]; h) n+ }7 I7 N
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)">
( P" b7 a6 a. i: J4 t) 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)">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>" c* R# o9 A$ n- g6 N2 x8 @
</div>
9 C `% n; ]0 r! l9 M9 `<p> </p> U& [ U9 A) @0 E5 I4 `" V
|
|