|
|
: n, D- X5 [7 [" Z5 I4 w6 w- M! K<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>
a6 e6 u# r& |" F3 A<p> </p>
; {" l; c/ h) v7 ?# F$ Q0 u# {( t<p>一、命令自动补全</p>
) y$ V( p2 A* h% b. e/ u! t/ K# _<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>* R3 I( }# @& t$ k+ K+ Y
<p>1、安装auto-completion工具</p>
9 ~2 C& o2 |* s$ w<div class="cnblogs_code">
8 O* }. {3 p: h7 E( ~<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update% |; f# h9 `7 B1 {
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>+ q5 y4 l" I2 y8 b$ ]+ B8 @7 X( M4 c
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>" o0 `8 I( Q$ Y, m, C3 O
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>/ d7 E5 b. i! `9 {8 j
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>2 [4 s1 u6 h- u* j0 A! {1 e, c
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>
. l5 p+ m2 z: `! o6 T, S<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
6 m L; m$ _+ [% k1 b5 TBuilding dependency tree: d6 @+ e4 D1 k
Reading state information... Done
8 A, s& f t3 U& I' z3 O</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.0 y0 u, @2 m1 `3 ]3 Y+ T
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> apt <span style="color: rgba(0, 0, 255, 1)">install</span> bash-<span style="color: rgba(0, 0, 0, 1)">completion! [3 w7 G( v: G' A) `
Reading package lists... Done5 Y+ N$ X" d( |
Building dependency tree
5 ^+ w3 N$ e) x+ A4 GReading state information... Done
# ^7 M+ _" |3 P' z7 y" w7 w; jbash</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).& T0 k8 S3 U3 I0 s" D
</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>
7 l3 T2 F% _8 z! {2 P8 @1 k: O+ R</div>! J( x4 b% P7 z1 A# O0 v
<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>4 C8 h& B/ K8 v$ {
<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>
' F6 G) v" _2 Q/ ~, P<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>
3 C8 K+ j) E# o0 Y+ A f<div class="cnblogs_code">
* h; C. f2 |! ]1 ^<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
* I6 c7 [! y" g) r G: J# x</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>5 a( o# y5 d2 D
</div>& s4 W" W4 y, V" E }$ G% H" B
<p><strong>Zsh</strong>:</p>/ _& e/ ?: F6 A- d
<div class="cnblogs_code">+ D3 L9 [ d( s3 T0 y% e7 ^( d
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
3 o9 I( C* H8 w0 Y</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>( ^' _0 h& f! f+ K& T( j4 T1 W
</div>/ X( a. F. r! v# e/ ~
<p>配置后就可以通过Tab键自动补全命令啦!</p>7 C# L/ F. w; p- m5 B
<p> </p>- C1 I% A k3 I( W7 Q# D
<p>二、配置kubectl别名</p>
( W+ i: ?$ O$ @& c<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
- O1 q/ a3 t9 Q, p* @5 R' I: }<div class="cnblogs_code">
! a# J: |8 @5 h" s<pre>alias <span style="color: rgba(0, 0, 255, 1)">sudo</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">sudo </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)"> V( O7 r x. `' T6 |& E- 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)">* E7 ]' j+ b( x
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)">
7 O' {) I% ^) w# ralias 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)">
5 K7 k2 w1 P0 |' H& halias 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 }; }: P1 V5 u6 balias 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)">* o- S( O+ r2 t; A r
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>0 g- U1 }; j7 L h/ F8 }
</div>
6 |8 o" N- E1 L- I<p><span class="js_darkmode__4" data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)" data-style="color: rgb(0, 82, 255);"><strong data-darkmode-color-16446330660319="rgb(0, 104, 255)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 82, 255)">PS:alias sudo是为了解决sudo下别名不可用问题</strong><br></span></p>" r6 p4 p' p- S) I, H
<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>; s L0 ]" G+ @, H* U9 E
<div class="cnblogs_code">
A3 b1 l( i$ P( N- ^! T<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml+ E, R/ c5 q G2 T) ^- V
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created( {" ]% {" g' L; M {9 n
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods- r! d3 j* S* T
NAME READY STATUS RESTARTS AGE
# J' K( o2 Z) P$ }! gwebapp </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
0 h2 T5 @2 e7 Q1 e4 F$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
% v" k: _7 ]1 o$ n7 gName: webapp1 r ?7 m+ z6 z
Namespace: default* N! T7 Y1 F1 q9 g7 ^
Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">: @# |" F) N+ K1 ~1 {$ X
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)">, u+ D- k* w# i1 g$ X- U1 v
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)">& N6 Y# B% O4 K
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp" _+ ] b0 p0 h/ ^" k
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">7 x% o7 K& y" o# \
Status: Running
% G) N" p- C2 @: d4 b! B& NIP: </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)">
! O4 p, [6 n% M2 Z9 RIPs:
) N6 O7 y- l U& M1 K; j 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)">
. x8 N6 Q2 w+ c6 J% I& F; {3 vContainers:; O# v) R6 w$ x: a1 S W. Q
webapp:$ G: P% ?* ~1 b8 J9 c% T
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>9 B4 Y$ i8 Z5 h, D6 j+ {/ V* q
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)">; r3 b1 N% |- p+ }) s1 X0 I
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>
# K; y9 `) T6 \- t, W) W* u( b Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP0 E* z+ v& d( ^% @+ S
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP; v$ n3 ^$ @, `- K
State: Running9 ]; N1 V+ I( q! i% 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)">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)">
+ B& U5 i; l8 Q& I- F Ready: True1 \+ a$ g. e D& Z X
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
" B$ x$ A% W7 G A2 L Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">; K1 L& q0 c# \; [
Mounts:4 M8 f1 U) E3 X) E5 @3 v ?8 ]" k
</span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
x9 s3 z$ R; L1 Q. ?. F; ]# k) J </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro). q& j9 `: v6 @% ]/ [/ D0 z
busybox:
- W2 n7 Y2 Y) H e Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>) K1 Z# T0 v7 E8 S' v6 N4 M& a
<span style="color: rgba(0, 0, 0, 1)"> Image: busybox
, v7 X1 ^/ c9 P2 v( z5 C 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>
# X, m0 g* h# a5 M3 n Port: <none><span style="color: rgba(0, 0, 0, 1)">5 y6 b! `( U7 a' L- ]+ b& o ~% g
Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">0 F% F' V$ `! z, b7 b1 x: e2 B/ @
Command:
' Z% O! L9 g( S$ O8 b4 j </span><span style="color: rgba(0, 0, 255, 1)">sh</span>7 m- \+ ^7 S/ X6 T. N) Y" c% I
-<span style="color: rgba(0, 0, 0, 1)">c
; R* {7 D. ^7 l5 q; X6 f' C </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out2 r; ]8 c5 _' L. q- F" ~5 m! h: M$ U* I
State: Running5 \9 m- Y' E. v
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)">4 }3 K8 H8 f1 G' a( E! N0 `0 `
Ready: True
" V p0 I/ W2 }8 Q3 l* H9 F' U2 a Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">8 d& ]& H4 q" S F
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
7 R6 V7 b, F, S+ a Mounts: }# y0 n( V7 C! Z- E
</span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)7 B! H. _- I6 _* N% Q' f9 s& ]
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
, b2 H+ @5 g7 zConditions:4 p) c7 U. }* {1 s; e: c
Type Status
# Y% H. W4 N# {- x) G Initialized True$ s8 [1 ~3 s' {7 P
Ready True9 l) O4 T9 P1 k& D x6 ^! J5 k% u
ContainersReady True" |2 Y: X4 V7 A2 Q2 S6 C, A
PodScheduled True
& l& x0 ]% Y0 _2 n$ D! KVolumes:% z! _" }# q2 h" z3 t
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:
+ H. ]* I+ q% I5 c 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>2 h' X# p/ s3 V" t
<span style="color: rgba(0, 0, 0, 1)"> Medium:- { @, m; S' R
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
$ a- [1 A; u2 S B3 U8 I0 m4 } default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:2 o, }2 C4 v% g- ^9 n+ q
Type: Secret (a volume populated by a Secret)0 h1 k; _/ b% E$ m" T. D7 A
SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h
! J, K& a+ b0 @+ [5 `" { Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">& c8 J9 ] y2 T& M, I) t6 L
QoS Class: BestEffort' Q' _- a& {5 B- x4 k- W$ W
Node</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">( g5 j: {0 B5 K: ]4 R
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
- a$ C% u/ l- J3 N5 c 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
2 Q$ K7 j1 S- `Events:( N( ]( b; }7 j m8 g& X
Type Reason Age From Message5 n4 u% G* z% s! I5 v0 V/ B
</span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">/ l. D: x9 F5 @$ f. Z8 t- |% e2 s
Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
2 } i0 Y. |! O* @1 a$ l* V 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
5 a9 X+ h B3 ^; \3 {$ ]8 m1 [ Normal Created 2m21s kubelet Created container webapp8 I; S# W X; R, z) J; m
Normal Started 2m21s kubelet Started container webapp
" N5 l% G/ S, `; m& o 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)">
* z- _- H5 P+ k- g( W; P 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)">.633078305s
1 O0 Y2 h+ d1 @+ ^8 p% ~6 k Normal Created 15s kubelet Created container busybox
/ m% Q; ~0 h- b* s4 @ Normal Started 14s kubelet Started container busybox</span></pre>
+ V: ]* Y; c# t- M& X# B</div>- m; S. u, K; J" ^' W
<p>真的是飞一般的感觉!!!</p>
: k& ]& ~ d* C6 H<p> </p>
8 V) P! k( d* b! I. H! V% Q% t' E4 O<p>三、Context和Namespace切换</p>
+ a. o7 M! m' \- V8 T5 |$ h<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>; T: |8 o1 ?$ P! W2 ^7 w
<p>kubectx安装</p>9 M- i. R a$ l! G: \1 e
<div class="cnblogs_code">1 @5 B; E. T! z8 y) b
<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>1 B$ `7 {& o( p& h/ ]/ \
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 D- w i: a5 w' e+ K" K# X( T* w
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)">.
h* I3 L0 H" D, \5 Yremote: 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)">.
! j: o; i# u+ q$ b9 S; iremote: 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)">.& ]/ R1 I) c5 _4 C
remote: Total </span><span style="color: rgba(128, 0, 128, 1)">1457</span> (delta <span style="color: rgba(128, 0, 128, 1)">85</span>), reused <span style="color: rgba(128, 0, 128, 1)">97</span> (delta <span style="color: rgba(128, 0, 128, 1)">51</span>), pack-reused <span style="color: rgba(128, 0, 128, 1)">1285</span><span style="color: rgba(0, 0, 0, 1)">* J6 O4 I* z$ ]0 l) g& u& I
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)">.1 s* m8 K4 w. z5 t5 g# s
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)">.
4 \; E7 S8 X: B7 o$ I ^+ n) [$ </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)">ns6 I9 n- t# z& N Z! J
$ </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>/ y; y1 |8 ]3 P! y' D
</div>8 j3 f$ d8 p5 y) r/ ^5 O- h
<p>我们来看一下效果:</p># d6 t& m2 O& Z4 a. Z
<div class="cnblogs_code">$ p o3 }2 d) {
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx# p ^$ r5 i: ^+ C3 X& E8 n
minikube
: F8 D9 |) m& W2 a$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube0 Q, p* K& W( S9 p- b
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)">.
9 M8 g4 h( d: O$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns2 s# D4 u1 b5 i% Y% |) N% x
default
) f6 e+ f1 z! P0 tkube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease: d- d( v) Y- @7 ^9 ]) D7 |
kube</span>-<span style="color: rgba(0, 0, 0, 1)">public5 b: d( s' ]8 ^+ t
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system
( O! U% ^* W$ `1 o5 Skubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
6 ]+ I3 H$ d: W$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public
. ?: Q- i# h; b. L* dContext </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 A8 ]' y; K$ y6 {) X; p
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)">.
7 K. Z7 e' a. H" Y0 F* b3 _5 O$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default% {# X7 P: j6 K5 z, q) T0 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.
% u: ?+ J b, i+ j' G6 [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>* T; \/ T' z! \) v* }6 g
</div>$ F# d( \9 G$ S4 C/ Y$ l
<p> </p>
" A$ e; O( B4 H9 l( v$ u<p>四、跟踪查看多个Pod的日志</p>2 C4 y, u2 V$ A2 Q8 W
<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
, _& h3 | r) M2 j<ul class="list-paddingleft-2">
1 D4 c j3 S! S8 E<li>
Y& P+ o9 K' h# c8 w<p>允许使用正则表达式来选择需要查看的PodName</p>
`% ?1 D+ o1 U</li>3 s# ?' g# Y7 }5 q$ G0 J' Q4 h4 A
<li>
( c* K' ], T, T5 N<p>为不同 Pod 的日志展示不同的颜色</p>0 E5 R. x; W# i) o$ j8 K
</li>
1 k% ^4 ?5 v! s! Z8 R<li>. Z1 S$ |4 M3 b$ |
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>
8 }! z5 @; p% P3 _# X* R$ x1 q</li>
& b2 n6 M6 M; Y6 }6 [ r</ul>6 k& v) o3 Z! w
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>; c* D I5 z6 y, F8 x
<div class="cnblogs_code">
" M7 Y% N( M3 |( d) [% ]$ _<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>8 B" x- B# t0 } O8 h3 D
<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>* V1 b1 ^, x& }4 M3 X
<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>7 t9 V+ n# z6 f8 \, J% I
</div>
5 I6 N* X% t0 X3 V- e, r<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>6 D1 l% O7 x) g
<div class="cnblogs_code">
9 A0 h8 H; @: E- |& l* i1 Q<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)"> .
9 M" m5 D6 W) w$ n6 N</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox0 z, d w. \$ J% F0 ?! b
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp
5 ~8 y5 y9 v7 Gwebapp 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)">]
/ f6 T- N0 G3 ? h+ I; T) B3 S+ Jwebapp 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]) f' R8 F2 _# I2 i' J2 N$ 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)">]% k$ a: t) z4 b. N" f2 J, ?2 ], 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.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext: M! c' F r) g7 Y1 u8 D+ O+ f5 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: B& S$ Q& M4 g3 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.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)">6 o' s5 l+ h! } n; R% b8 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.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)& u T( n) A" T. {4 @
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)">]2 ^) [2 y2 [3 r2 `* Z2 E% C- L
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)">( p# w* M* o& G% Q1 E4 x B* b$ I
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.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)">)2 n1 V8 v* M/ ?$ k8 |% R
webapp webapp
3 x0 ?, D# R, N7 w+ _1 U0 Zwebapp webapp . ____ _ __ _ _
" d% v* o# N/ W+ b9 |6 Ywebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>
3 G( W, d; B/ l. M4 [8 E6 Qwebapp 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>6 g& z: x; S$ T' G% E
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
- C2 X7 ?1 K5 dwebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>2 l" x) q+ X: D/ q% }+ }- N
webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
5 c2 o1 C8 ?+ E7 `4 N, x* M5 kwebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)5 A# e& ]* [' e, y2 F2 _
webapp webapp1 G* ~& |2 n, ~1 W
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)" C3 v2 a9 X: p Y; A" c
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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/ U! v! U5 F! i$ 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.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): R$ W: K, F6 z7 N# U1 w; {
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.197</span> [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] Initializing ProtocolHandler [<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">http-nio-4567</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">]
9 Q+ J1 l* M4 `5 N5 f& x$ }$ _2 qwebapp 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]
. ?$ n& m/ ]5 S$ 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)">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)">]" J% x/ P8 F4 h u9 K1 _$ W% 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.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext. R/ ?6 a5 s4 W, [7 h
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)"> ms9 P9 a! F' C* w3 T! _! g: 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)">
* w) R) F# u, ^1 w3 O; n* Jwebapp 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)
2 g4 z$ j) Z0 R5 O* X2 ^' 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)">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)">]( K5 B: ?0 x7 M1 f
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.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)">' b3 g T' Y/ I" t
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.509</span> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] Started TodoListApplication <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">6.235</span> seconds (JVM running <span style="color: rgba(0, 0, 255, 1)">for</span> <span style="color: rgba(128, 0, 128, 1)">8.074</span>)</pre>
: r5 N" I3 c% V" j! b7 H/ \ W& w</div>+ `2 t; B& }1 s9 g
<p> </p>
3 |: A) K. Z& H ` ^ |
|