|
|
+ {, o4 |' J9 w1 A<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>7 m. V. ^4 q' K+ e( P# R
<p> </p>
+ t' v2 ~0 `6 j& a4 W9 @3 l<p>一、命令自动补全</p>
; e3 g, V& w- f$ R. k; F# e<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>2 g& I8 k: U7 L. b
<p>1、安装auto-completion工具</p>
0 C" h2 Q4 q9 ~9 x( F" i<div class="cnblogs_code">
0 ^/ _6 v+ Y) V2 r3 T/ f1 V8 J7 c/ z<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update
) Q# n9 a5 i) E6 @ W( ZHit:</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>
" R: V6 b2 t% h; nHit:<span style="color: rgba(128, 0, 128, 1)">2</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">security.ubuntu.com/ubuntu bionic-security InRelease</span>
4 `6 {. w; Q7 x# k% |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>6 T& T+ G( u" W+ Z# v+ b
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>
/ v7 A' [) } A; J" EHit:<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>
# V9 F+ j! W& K2 U5 \<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done. n% z1 T: ?0 l" T
Building dependency tree4 U* ]* h) T( `4 A% b5 Q3 m/ J9 h6 }
Reading state information... Done$ m1 h1 x/ u; O- d& ^9 [8 @
</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.
+ P9 a0 V, j8 L. t0 X$ </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
! S/ x8 [+ L9 c) n1 \Reading package lists... Done
; u% r) Q+ ^5 UBuilding dependency tree
9 a. G) q1 M- t1 E% xReading state information... Done
' e: n, R4 x; z8 @$ Wbash</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).% _- }( O7 K4 v7 O1 X
</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>3 ] M, I0 M5 A) N# R' O7 L$ {
</div>" ?$ I$ B% Z5 H H' K
<p>PS:如果是centos系统,则使用<span class="js_darkmode__0" data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)" data-style="color: rgb(0, 82, 255);"><strong data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)">yum install bash-completion -y</strong>命令安装</span></p>
7 R* e. \" o9 f" j2 i1 K& f( }<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>
& D, i1 y) [( l/ {7 {6 W* A& V) r3 o<p><span class="js_darkmode__2" data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)" data-style="color: rgb(0, 0, 0);"><strong data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)">Bash</strong>:</span></p>8 J3 s/ l2 W5 ]
<div class="cnblogs_code">2 n6 l8 Z6 k" [
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
( C% ~4 a) {* K# u* Z</span><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">source <(kubectl completion bash)</span><span style="color: rgba(128, 0, 0, 1)">"</span> >> ~/.bashrc</pre>
: a- W B" r/ s) S) n</div>
/ n) m5 w* m$ H% a<p><strong>Zsh</strong>:</p>0 F1 Y/ T' ^- l, K; v/ t
<div class="cnblogs_code">
' h h j% M1 v3 J1 {8 B$ I# X d<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
2 r& X$ I. I! r0 \$ q- G</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>
. P& o9 B+ [# P; k) {" @3 i</div>
3 H9 D$ L# J6 {% Q; | Y<p>配置后就可以通过Tab键自动补全命令啦!</p>! o. H/ i, k2 g0 T) n
<p> </p>
: r9 v6 ]2 s5 n<p>二、配置kubectl别名</p>
( j( q! _5 Q8 B# W N<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
" N/ `: I D& E, Y. g% j<div class="cnblogs_code"> c# |5 s6 [/ K
<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)">3 o# O) V" B# q# W2 g M
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)">1 @( S' y9 |, u- I. H
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)">; b6 F! ^. n5 J$ p, c; j' h" y
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)">$ ^* E& c! ^' t' q0 a- X1 H
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)">3 U0 ]8 h; F5 ]; e l5 h& w3 o
alias kg</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl get</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">
1 R0 C N0 [' f- U3 yalias 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>
! G2 B# {) e& `0 n$ @! E+ h$ D</div>
* {! Q- u& t( C/ D" s5 i& b/ D<p><span class="js_darkmode__4" data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)" data-style="color: rgb(0, 82, 255);"><strong data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)">PS:alias sudo是为了解决sudo下别名不可用问题</strong><br></span></p>
$ F w9 U& I" M' V' e Z/ V<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>$ M# a% j, U5 n+ h% }
<div class="cnblogs_code">$ X. v& k$ d& V+ l% P' r" E
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml+ ?+ _% P Z( n+ w, a
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created v1 F. N- \( H# t1 x
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods. v& r- ^0 R# q0 J, b
NAME READY STATUS RESTARTS AGE& F$ N; b+ C: u" C6 z
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
2 x6 z3 W: `" o( \: i1 V$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
8 [, S+ C- E t2 H k0 j& J: V. VName: webapp3 n1 K. `5 X3 m1 t, ~$ x
Namespace: default
+ }3 I2 e: Z: H' W* }4 ~Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
2 B0 D/ n4 i' oNode: 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)">
. S8 `7 W1 ]7 f3 E& d7 f* YStart 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)">
* J0 i* x6 a4 O" dLabels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp8 o- s' t% |7 ], s9 m- G
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">; W0 v/ x& B" c3 C
Status: Running8 K# W8 e/ t0 N1 Q/ v( \ ~" n5 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)">
$ N/ _* `- L7 N+ q1 N% b& ?4 y- \IPs:# m- |. r( Q2 _5 P9 X
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)">
& w6 U& J' v! `8 w; B$ ]7 mContainers:) y2 \2 C! k( ~) v0 V
webapp:' D. d, c8 T6 \# Q Q$ C6 T
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>, F0 g3 L: V+ O8 x6 `' J
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)">
: ?0 e0 A8 M5 F5 ?* ~ 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>
- J1 d" G! j% f; \8 K2 n& a# v Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
$ {7 ^7 m Q7 P9 T# Z) |0 G Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
/ h* E b8 o0 x/ o/ a" e State: Running
3 p" @4 n0 s* b' w; K" _" Q 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)">
" L4 a3 [( B- S1 A% }$ G Ready: True
0 I, r; d3 S) ~# r4 y, D Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">- e& @- R% \. i. _
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">2 I. d! a2 Z9 h& ^0 o8 O: D
Mounts:
+ O! v& N/ ]$ p' h! R( Q9 s! J. z </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)! }: x' f3 W5 ^; k- W4 B
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro), ^4 h& L$ r4 l, ]/ }
busybox:1 _4 u# t5 ?% J0 l
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
, @ i/ G; {6 e& Q/ J<span style="color: rgba(0, 0, 0, 1)"> Image: busybox
5 ~+ q& u3 q# i5 K8 Q 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>2 B4 Q4 ^0 \' C$ ^* ~# z$ a
Port: <none><span style="color: rgba(0, 0, 0, 1)">6 d3 p+ B: |1 `+ G# }
Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">
' ~/ ?' x2 p8 M2 `3 @ Command:
2 ?8 {1 q* \8 l- \ </span><span style="color: rgba(0, 0, 255, 1)">sh</span>- Z7 T4 B9 p& w) A/ ~9 [
-<span style="color: rgba(0, 0, 0, 1)">c3 \- o# X4 [0 W5 H
</span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out
# l( E C) c7 } State: Running. i1 d0 l @$ }' I
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)">
5 J" Q8 G0 |& i$ Q5 A/ d" W; H$ c3 j Ready: True/ n! M9 }- k$ l' ~. |- m" |6 C
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
$ a5 {9 U6 P2 B( U Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">4 y% }0 N- f5 l' B' ]) \
Mounts:
; X9 b- K5 Z. r v& F </span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
: }' ]% Q4 v0 u' _( i8 y' h7 r </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)4 l4 X9 z9 D4 o$ O
Conditions:
/ T) g- C4 C0 a$ M i9 B Type Status
- J$ k, Y! H; |7 A7 V, V1 q Initialized True6 W& @( c$ h6 `5 ]
Ready True( V$ N* n4 O. {# E7 [! J8 X7 s
ContainersReady True0 @/ _) s$ K; y6 {
PodScheduled True5 n. T0 L0 L0 a4 U, Q
Volumes:
! R! q7 e5 ^2 L& X6 G webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:. @6 z. e4 _# _7 D' S
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>- q9 J% j6 t: v& h6 D; C( w
<span style="color: rgba(0, 0, 0, 1)"> Medium:
a/ Z- \# t9 A1 f/ K" c SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
% n* n2 i; D- N5 `% s# _ default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:" B) G# O! w% i5 U+ J
Type: Secret (a volume populated by a Secret)
, T: o9 T& d& K/ e" N6 K: o% T SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h
3 L/ ^+ a# r2 S# M4 h. Z Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">2 d% ]5 P& l# f
QoS Class: BestEffort
# [4 l' J( s* L4 G4 f2 dNode</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">8 y2 ^7 C/ x3 W/ C& o
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
0 P3 {9 X6 N# ]4 H [ }) o 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) `3 Y8 q1 {& U8 s. Z3 o' U
Events:
. Z& f, b8 Q9 _3 O Type Reason Age From Message5 U9 L. G* K8 t) B1 c/ J3 {" ]
</span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
0 c4 p8 U- e; m2 s. ]- n1 ^ Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
0 d7 r5 a- ?/ C6 L! { 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
( a1 z: s5 j* P/ X2 E" D3 l Normal Created 2m21s kubelet Created container webapp8 E+ S" S- r" H* a0 T! P" `+ }5 ?
Normal Started 2m21s kubelet Started container webapp
4 e# A# C/ w% z9 P3 |7 H- L 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)">
' T- Z' C# j' ~1 c( W Normal Pulled 15s kubelet Successfully pulled image </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">busybox</span><span style="color: rgba(128, 0, 0, 1)">"</span> <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">14</span><span style="color: rgba(0, 0, 0, 1)">.633078305s( {" T" v5 f0 s$ m6 P7 R+ x
Normal Created 15s kubelet Created container busybox, J+ C. }4 e' G" F
Normal Started 14s kubelet Started container busybox</span></pre>
2 R# y, @/ |! }& k6 z</div>
K8 x# l$ m y1 ~. K0 v. V- w! C<p>真的是飞一般的感觉!!!</p>7 h) x5 b9 W4 F. Q& E
<p> </p>9 M; `; n( a/ k
<p>三、Context和Namespace切换</p>
) t% v: u4 I3 J0 J& |* V5 A<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p> T, Z# V" O, t/ Q5 p# j. C1 o3 B
<p>kubectx安装</p>+ r; T; `6 P/ S) n& l9 t
<div class="cnblogs_code">$ |5 U' x5 n& Y5 z9 G
<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>) G7 s- u& c: E+ A' X$ a% I9 ?
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)">...
3 S' V! o+ H7 \& H0 Wremote: 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)">.
) Z7 E! |5 L. ?' l/ _9 Oremote: 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)">.# i! Q5 q; _- Q8 o) j' b! l* j! r$ i
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)">.
; U1 X4 D; w: k ^' k; |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)">4 Q) n3 |) [! K2 a
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)">.9 S) z+ o% W7 G+ F
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 N7 t9 W# Z0 e* X% \9 p9 q$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> <span style="color: rgba(0, 0, 255, 1)">ln</span> -s /opt/kubectx/kubens /usr/local/bin/kubectl-<span style="color: rgba(0, 0, 0, 1)">ns
: ^6 L) o0 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/kubectx /usr/local/bin/kubectl-ctx</pre>
2 n- }6 A( l, q5 Q: a, r4 S1 F4 ?3 Z</div>! C2 i& z, A! K0 q. \
<p>我们来看一下效果:</p>
, }% e$ t( [ L8 K6 g4 M# R4 p4 k. Q<div class="cnblogs_code">! t; e6 _8 Z: v' x7 y0 j0 L: R
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx
6 A2 P8 I) \1 R; j/ }minikube
9 l3 ?7 W' F' D2 i7 d) z' I, x$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube
( A3 r. V8 J7 D( D+ H4 w; \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 r' J4 \+ f K- s' H$ [
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
; p# ]# K# @7 V# f' b7 \default
* g" X* K& d; y$ V7 P" I/ q3 L vkube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease: e* U' R- i: i; h- E" l& C
kube</span>-<span style="color: rgba(0, 0, 0, 1)">public& T- ?5 N. [. m% M4 \! a
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system& P* s" N/ ^( Q9 O9 w2 j6 q- O. L
kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard" R* d0 j/ D; P9 o, W* [- i+ O: Q
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public
- y- x- U6 I, V$ OContext </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">minikube</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> modified.
6 a1 }2 Y6 F4 O* m$ J6 AActive 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)">.& f _) s& e( G
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default: [) {0 \0 j1 f
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.' y# B7 }; R& [) 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>
4 `9 A1 g3 z$ c</div>. \2 d! P( N; O4 B* Z8 i# p: g
<p> </p>2 J( I5 a# A; i9 [3 S8 W
<p>四、跟踪查看多个Pod的日志</p>* g ^ l+ T+ \' U" O
<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>7 H2 ^0 c# ?6 F6 w4 `( W
<ul class="list-paddingleft-2">
$ w7 C/ F0 ]3 ~0 i<li>
4 t; o/ w( J$ Q K9 F$ D$ [<p>允许使用正则表达式来选择需要查看的PodName</p>
5 @: |( s/ M# n4 {" B5 S5 q. d</li>
2 p! Q: e c6 _" [; ^& C9 ]<li>
$ ?2 y$ c5 d( K8 S& e- B) C2 O<p>为不同 Pod 的日志展示不同的颜色</p># Z# x5 o. c' ^# [4 v& S
</li>
0 J4 N |2 t7 ?7 m% |) k$ Z<li>% o0 c/ p0 ?" d) D0 O/ F
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>
) E/ W& I! U5 u" \ z& h2 ?</li>
: a2 w% f6 S! S& p</ul>9 L/ ^+ P, s2 t+ t' z) f
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>
0 g( |& ~& P. e8 Z# E. K# r/ b( d+ W<div class="cnblogs_code">
% E2 F1 A- _* h W7 T }<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>
& r6 a- X7 G' L8 T<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>
7 i% M$ n- H. H Q; V<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>9 a+ p: v7 @: t5 T, ]* D
</div>
. Z0 p; J {; e+ D z2 R<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>
; c' {. F( y! M( w: x# j6 c+ ^<div class="cnblogs_code">
( u2 t5 N6 O2 ]: ^6 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)"> .$ L" U, z0 z* T& A; W2 P
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
/ O8 z# E' A* ~, m: H" c</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp
. m; L2 |- O6 B# F& 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.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)">]
" Z6 w" u$ S& N3 E' twebapp 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]
8 p9 z% o' w3 ?/ E/ 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)">]+ n: q- o4 u2 h" |& m5 K
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext
. v: G( D- Q; a4 c- ~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 ?7 w. I- Y, i, C- d% n
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)">
2 D3 @, p# b" ?3 V fwebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.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)
, Y5 C) g3 b' }) _# r1 z4 N& ]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)">]
. O8 ]% |% T1 G9 C5 Vwebapp 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)">
. v# Z ?: c( l4 L; 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)">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)">)
& E+ ?4 R" d1 f/ cwebapp webapp% c) u0 B r) U
webapp webapp . ____ _ __ _ _
$ T8 Q" _ m7 R! P) |7 v Q! I. Fwebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>$ S0 K: b/ H; f& `9 E
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>! ~- G9 s; l9 n: b7 w) k: q
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
4 {6 K9 d! f9 Q* A1 u, Bwebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>
8 N/ ]: i1 I; F+ v Awebapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
( r" O5 \2 b: R* p awebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)! W: l z" D! ^1 F( W; X$ W3 I- e
webapp webapp" |9 T3 e8 J* P! 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)">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)
" {2 T* C( G& 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: default7 _# k- r; H# R; ~* ]8 r' G2 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)">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 i) i8 H7 v6 ywebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.197</span> [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] Initializing ProtocolHandler [<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">http-nio-4567</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">]3 y+ Y- C, n+ X- E( 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)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
$ F% s2 J: Y' P9 H% y! 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.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)">]' W; _9 q5 T% w9 S3 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.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext! @8 M- V" E* F
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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
+ i) M4 q9 J) N# Ywebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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)">1 V" T9 E- R7 |; w$ @+ V
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)) a; ?( w! N- g& l# m3 \* Q# V
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)">]
' @% }: m) l- \9 i# wwebapp 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 g: \% J/ ]) K% S7 e- y& 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.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>
- y( l9 ~/ I8 T" D. R" V</div>) G+ S4 F; w# R$ B
<p> </p>7 Y6 }: i R2 h2 _7 ]5 s
|
|