|
' y" N ]; \1 R5 g' i<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>
$ r- l. W$ E3 J- N" q! u<p> </p>
2 B8 p" R+ p2 p8 e1 ^<p>一、命令自动补全</p>
# Y" o! h) c+ ~+ a f<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>% O q# ?5 m; F1 {& a4 G9 e
<p>1、安装auto-completion工具</p>
" K- y1 q6 p( i5 z) h2 k; I<div class="cnblogs_code">1 q8 j$ T2 Z; u4 q* O$ p
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update
, r2 a* q2 y; c' h, m2 ?Hit:</span><span style="color: rgba(128, 0, 128, 1)">1</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">archive.ubuntu.com/ubuntu bionic InRelease</span>
* F, W! z$ m) E! Z- eHit:<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>
& k# m9 p8 d5 I6 B* YHit:<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>
5 K- ~$ u6 h" C2 VHit:<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># r( {" b2 [/ ?4 n
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>
5 s; Y6 F- y+ m+ k( o<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
) z2 `0 {% k! P! x5 U4 j% \Building dependency tree/ i9 m8 P4 `3 y7 U: U9 M3 h
Reading state information... Done; {7 p5 H0 U s, q0 ~5 @
</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.
+ N6 {2 V" b' z) H( O4 ?: i$ </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) g5 s5 L0 D! T0 z! A
Reading package lists... Done
) @$ p! x& M- P R& `. A: ?" N" S! cBuilding dependency tree0 o4 x- o% t3 t9 |1 J
Reading state information... Done8 P5 A6 L; z1 }/ H
bash</span>-completion is already the newest version (<span style="color: rgba(128, 0, 128, 1)">1</span>:<span style="color: rgba(128, 0, 128, 1)">2.8</span>-<span style="color: rgba(0, 0, 0, 1)">1ubuntu1).( x" Q. T, U0 `. y5 u
</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>9 a- X, c5 }; A6 h; w/ H1 O5 W: ~
</div>
% B3 y6 U' D# g; A. J<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>" X$ j7 [5 \# 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>
( W& M# d! Z* D9 v* |$ \<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>0 G6 A* S" o ?/ v2 `' d& K5 f
<div class="cnblogs_code">( ~0 ?$ C3 L! M4 d0 J; h' @6 S7 a: N
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
+ n8 [1 v( q- B</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>
6 a% g t% c$ s6 f- S, y1 K( }</div>
* `- P3 ?% x# i% n# I/ V<p><strong>Zsh</strong>:</p>
. @$ I1 j, z: m/ D<div class="cnblogs_code">
5 J# \: t: |- l. {$ D' Q/ A5 Y: w<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
7 E5 a G; a: z6 n</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>
: ~9 ?0 {% Z. R</div>* f0 X4 ~% |, T/ F) m4 {2 V
<p>配置后就可以通过Tab键自动补全命令啦!</p>
3 f; g, X; K& A9 e6 Y9 l) x<p> </p>. N8 _) V% J2 e, O2 ^
<p>二、配置kubectl别名</p>7 d8 R( I4 Y# y$ y
<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
1 t4 v2 k+ P$ F0 _/ L* F' x% U<div class="cnblogs_code">" M' U) a& h3 A
<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)">
+ n8 H# q' v) y7 U+ Z( Z& l& xalias 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)">: s/ i9 \0 V6 f
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)">9 h/ R9 C" V% T3 |! Y* a' Q5 S
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)">$ Y% q. q" I$ l# S6 c" m, d
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)">8 }* \4 J- \' o7 H5 K( e
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)">
" Z( s2 W# L: z( T1 x+ [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>& Q- g- T! T8 a& m$ L
</div>
9 [ p+ \' J3 L<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>
# K- Y- P# l' z+ c5 \3 ? T<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> f0 A+ Z) `8 m; K6 h" N
<div class="cnblogs_code">
5 A4 v" ]1 t4 Y. y. }0 j6 x<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml
y3 p" @) z' F/ O9 ?4 Npod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created- L/ G7 a, C p( p6 g, V+ q
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods
/ ^" w O# c% A1 ~NAME READY STATUS RESTARTS AGE# K+ G# G c9 ?; ]
webapp </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% w& p0 ~7 w* a) w
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp; P5 S! e: w9 D7 V g- u: L- q
Name: webapp
' `3 ?0 y- Y9 RNamespace: default
, K7 G# _4 E# c/ r) d, kPriority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
% R1 i' g% I* H! L! YNode: ayato</span>/<span style="color: rgba(128, 0, 128, 1)">172.16</span>.<span style="color: rgba(128, 0, 128, 1)">194.135</span><span style="color: rgba(0, 0, 0, 1)">5 R2 w E- ^* i) o5 k
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)">) W7 h9 J5 |# h( j2 J5 V
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp
. O# G- I# P* L1 DAnnotations: </span><none><span style="color: rgba(0, 0, 0, 1)">: C9 e- c! S1 W# k9 r) L6 t: U
Status: Running
/ W: f7 s. r; ]1 {4 OIP: </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)">' H6 u6 T3 t$ N4 M7 i- a' O8 ~
IPs:
6 U. |6 O0 x8 a; I 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)">
8 C+ X) h: X5 |( n+ UContainers:+ f0 C1 T" F7 Q4 d S) l
webapp:4 }" y* k9 F) F9 U* Z6 J
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>
8 W) o% Q% F0 p) j8 {7 S* e$ d8 Z6 o X 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)">
! B6 t' ^$ @" l# h4 @7 | 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+ _: |; ~$ N7 t( x) F/ g8 z) {
Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP- v! x9 Y, h7 j, X6 F! U0 o3 g: x1 G* R
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP( a0 }& I0 r8 w, a
State: Running
' {( r5 p6 ^) P G8 y9 @ 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)">
# ]* |; [ k1 Q& s Ready: True
& G _; \ l+ `. B3 }* X; f Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
' Q ?1 Y- H5 k1 S' @: F% ? Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">9 K9 N8 g: x2 [/ u7 Z( `1 }' j+ V
Mounts:
; |8 L! \+ \& `* }5 D# u: L3 f </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
0 \# v4 P: \) y/ c2 f </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
5 i3 F# [' ?+ M8 }1 P* d busybox:: w6 [1 n3 y' s- V
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
; j- |6 u* x* U& [<span style="color: rgba(0, 0, 0, 1)"> Image: busybox
' V v7 j# \& h- D 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>- `# b5 k5 h5 O, i; {) p5 `4 _
Port: <none><span style="color: rgba(0, 0, 0, 1)">
" e2 s. q: p7 g; b7 C Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">
7 ~" p8 E( g: A+ C, m+ i4 L7 p! Q Command:
) F# e7 a7 w) { </span><span style="color: rgba(0, 0, 255, 1)">sh</span>9 S: j! k5 s" J) l
-<span style="color: rgba(0, 0, 0, 1)">c
3 M" l" N% @% I- I </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out, D! v# C. R6 d" u) \$ Z# y; R% F9 k
State: Running% }+ Q$ ~- {8 V3 g; X# p
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)">% R2 O, T/ e; Q: [
Ready: True
0 t6 ~" M" e, P2 M Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">( f4 h3 f O2 }! l
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
5 y' T7 O! W R Mounts: O" o8 N S+ I4 l3 b P
</span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)7 e i4 i9 v0 ]
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro): X: n! G. f0 \
Conditions:: L, X# j: w; ^6 d% A' N: ~+ X0 ~
Type Status3 O! n& o# I3 D8 F
Initialized True/ ]- J- y6 U& f9 D2 _
Ready True2 | ~! R! g) H U K! x
ContainersReady True4 L9 R6 k5 f. ^5 X2 l2 k
PodScheduled True5 b$ E* U6 ~/ I- H5 X- b Q; u
Volumes:2 a+ @; z0 ^ i/ B/ t
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:8 r6 S4 i* w# C* M b0 o
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>5 z0 L0 }7 j& @1 w' Z
<span style="color: rgba(0, 0, 0, 1)"> Medium:# U) u' a' s! d) G$ l/ Q0 t* K6 f
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
2 v6 E$ N( Z0 Z/ |2 X default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:2 X' k b- s# Z6 T# l: \" ?
Type: Secret (a volume populated by a Secret)+ x! q& B+ K* v/ Z1 T
SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h% B/ S6 C7 u+ V
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">. `/ ~ Z" L1 X' {3 y* G
QoS Class: BestEffort( j6 G* o: h: {+ R+ V- i* b/ }1 s
Node</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">
% H% ~. ^2 \% k! ]5 P; c, QTolerations: 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
! \( U9 ^ q6 l. [6 _ 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
5 ], X$ Y* A: pEvents:
7 j( T5 `0 d1 w/ e6 ^ Type Reason Age From Message. {$ o' ^& o2 t0 H2 ?- |$ e
</span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
/ m+ ]0 q+ N; l1 H Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato7 D' ?6 _& |' P6 J4 e1 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 machine7 n7 r: W: x0 I$ j7 a# `
Normal Created 2m21s kubelet Created container webapp
! C E0 D. z! V7 K3 b4 S Normal Started 2m21s kubelet Started container webapp
8 N4 X6 j4 w" H. r! m6 v 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)">9 I' Z7 ? f+ G$ Y
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
" u) \; I% j, c1 @ Normal Created 15s kubelet Created container busybox+ G' [# z+ p" y; j; \" H
Normal Started 14s kubelet Started container busybox</span></pre>
U) z8 d) p4 M3 }( ?</div>
6 I# V5 J# a7 V5 V5 O7 ?- O& C: ]; V<p>真的是飞一般的感觉!!!</p>9 E* s' O- J1 V. a S
<p> </p>
6 h& L& j/ E O/ x9 Z<p>三、Context和Namespace切换</p>
, Y6 B$ o4 G" S8 ?<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>
, r( B5 `- P, O$ W% Y$ J0 E# X f<p>kubectx安装</p>6 a( U8 C T! |+ J2 U5 g' H4 @
<div class="cnblogs_code">: }: X+ q. w. L8 S% S
<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>
W5 V8 x) r) m+ ]9 T9 j9 cCloning 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)">...5 R, G' F. Q6 d& f9 k
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)">.( D! ]8 K, V! m' {8 k
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)">.
$ v1 I6 v& W) G& D6 R+ {4 m3 Premote: 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)">.: f/ F9 | v7 _% m# 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)">2 k6 [8 K6 f. J% Q/ 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)">.
6 y! Y: a; N" }0 ]: w }/ `8 C: `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)">.
; E c- l, Y1 P( g$ </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
' u/ J6 |5 X. \# t3 V$ f$ </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>8 P- w" `) n* y! f( L1 ^
</div>
! B( @6 j& e3 I2 ~<p>我们来看一下效果:</p>; u- a+ j4 s9 Z# l$ j
<div class="cnblogs_code">
- t7 H, _8 {7 H, T- E% \* e: y. x<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx3 M, a/ z6 F, t7 E& k7 y
minikube
0 u/ s6 n3 R, I1 W& a$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube0 e1 }0 P J; m1 Z
Switched to context </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">minikube</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">.0 Z7 e& h( Z; g* W$ h- e5 {3 l
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
. s' o4 t8 z3 a, m8 Odefault9 K( n6 t5 v7 ^9 @6 i
kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease6 F% @1 B/ R( ]* J, i0 r+ h9 Z
kube</span>-<span style="color: rgba(0, 0, 0, 1)">public& ~. W; j0 U# U/ Q6 l) ]
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system
$ M7 c, T: W* s# t5 k5 |) p8 [kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard& Q2 M; W7 L, M! h. o
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public
t {9 b4 M, T; N* ~8 q" E1 t" KContext </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.
. k% N; @- @2 a0 Z- b ^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)">.
+ j3 Z) I/ L" N: m" b$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default
; X" P! B e, g$ P1 K# ?; r# K% \% ]$ lContext </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.) f& r4 E; w+ U* g, A$ W, M
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>
2 p2 s. ]/ W# _ g% s, C</div>
! V0 B3 t! o7 n2 ~) K8 Q/ Y8 w# v<p> </p>3 T( x4 Y4 m0 J9 O; N
<p>四、跟踪查看多个Pod的日志</p>: x P/ \& W6 x
<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
! D( {6 b( z8 H6 [<ul class="list-paddingleft-2">0 ^+ J" d! v- S8 c5 P- u
<li>
5 q0 t3 V+ c, m$ F<p>允许使用正则表达式来选择需要查看的PodName</p>
6 `$ j- y$ S% I8 G' i</li>
n# C$ V' i# Z" l& ~<li>
8 r/ z0 ]0 S$ V. j<p>为不同 Pod 的日志展示不同的颜色</p>
; D1 W/ G9 m0 D" h+ h9 b</li>0 J$ Q! N% |7 I+ e
<li>
, s+ S) e* X# ?' K<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>
: V1 D) t' |; o, H1 J; Z</li>3 t ]. b' M- \. N# S% H1 C9 B9 ?
</ul>. A Y" U7 g% P; [" P( ^6 D$ _0 i
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>! M& e* K1 u1 I( E* n# p* D
<div class="cnblogs_code">
! a" L, d/ |' u0 Z1 b1 _<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>% R; [$ J/ l$ ]2 A1 K$ P+ u, s% r
<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>) @$ g2 K! |) }' [0 X7 D
<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>
4 r6 N$ I9 X! F6 B</div>
. m0 K, v5 g0 F( X" S$ Q<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>' _- T4 Q* A$ ?7 D' H9 ]8 i- }
<div class="cnblogs_code">/ |/ I; Y, A5 ?2 r7 A, @" X
<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)"> .
$ P+ p! x4 s5 Y7 x0 ?3 P</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
. J W) \6 l0 [5 ]% {</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp+ r8 K: F5 l/ |1 J: `6 I! e( _6 b
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">]
' R" |0 T: ^! b% h7 P 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)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
% }+ @& q1 {# E6 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)">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)">]0 C1 Q) [3 _& {# 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)">53.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext
) {( l8 V/ \( ]1 w+ X6 Uwebapp 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
1 i1 s( w, N* H; W6 L5 J3 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.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)">
8 T4 v. m: Z1 \1 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)">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)+ L/ e- Y! d2 K7 R) [: i' 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)">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)">]! K$ u3 i2 c* f% P1 w- B# _
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.481</span> [INFO ] [main] [org.springframework.boot.web.embedded.tomcat.TomcatWebServer] Tomcat started on port(s): <span style="color: rgba(128, 0, 128, 1)">4567</span> (http) with context path <span style="color: rgba(128, 0, 0, 1)">''</span><span style="color: rgba(0, 0, 0, 1)">
S, |, v. P1 v" X4 \, {! 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)">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 ~# y! v& L! [8 f$ B! K) Z. {; X
webapp webapp7 k* X% F: ]6 d' b2 E" ?2 K
webapp webapp . ____ _ __ _ _9 w/ w" j2 R+ r5 B7 k
webapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>
% P" e7 N2 `% Rwebapp webapp ( ( )\___ | <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ | </span><span style="color: rgba(128, 0, 0, 1)">'</span>_| | <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ \/ _` | \ \ \ \</span>8 B% L* |) p+ V& X- x
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )% H* C: S |% |
webapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>/ d0 q' W/ N' S, K. C
webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">8 p0 W) V6 s0 N
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)">)) p% j' G2 g' \+ A$ d8 S
webapp webapp
7 Y9 c3 g( d* Z, e" a* nwebapp 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); M) q C# `8 X& K. 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)">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- A" R# `5 Y$ f" t* H. p
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)
' O# ~/ i- N5 F; P% Z9 ^; vwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">]
" ~( Z! V2 e, `+ h0 zwebapp 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 q; M8 ?2 h1 W6 G- E
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)">]
9 p0 e( Z4 q$ T% q5 F# nwebapp 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
+ t0 B* {( V6 Z5 C: d8 N6 E! cwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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! `0 s5 r: d/ _" {& d- c* Q4 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.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)">: s8 y( ?8 }; ~$ y$ t' 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.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)- W5 V( H0 J/ A: i5 m" S! M
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)">]
" y2 R$ Q+ L; U$ Q5 P4 B8 xwebapp 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)">
8 v9 @; x' U; r7 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)">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. C% y5 Y/ A3 ]
</div>7 U/ R( C( k9 G0 c5 Y4 c/ {
<p> </p> o2 r9 C& P1 ^( O8 ?: |7 ~
|
|