|
' ?" I4 p# i* U( k: ^
<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>! p- ]- O- _7 i- q/ B
<p> </p>" i! Z% t! ^5 u) v; D
<p>一、命令自动补全</p>0 P1 G) h# K; z
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p># }2 M" F* i( |' d7 ]
<p>1、安装auto-completion工具</p>
/ w7 B* v! c1 E) Y7 r7 G! Q$ J<div class="cnblogs_code">
6 K D6 T! T0 y<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update
/ X5 P2 N6 ?6 q8 RHit:</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>. {& }$ d: O, r
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>
4 t$ S, L ?& _& r! x/ d1 |3 H) G B* KHit:<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>
3 V, O: C( N- w# g; gHit:<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>
4 p5 ^0 ^0 Z- j! D" `1 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>
3 H7 H0 r* u3 r: D( J, w<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
- e- r$ Y# [9 p7 `- ?6 [, BBuilding dependency tree3 Z9 M; c* g* W
Reading state information... Done( }9 _/ P' p2 |6 x* ]
</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.
9 Q, Z0 { h% Q5 _( e$ </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 _4 m% m4 S/ Y9 [Reading package lists... Done2 {. A/ j$ a; j/ b* K
Building dependency tree
+ h) `9 \, W$ `7 ^& J0 `' YReading state information... Done
9 a* h) B( t( f; ~" ]3 abash</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).2 m! m6 r0 p* U1 E% c. _
</span><span style="color: rgba(128, 0, 128, 1)">0</span> upgraded, <span style="color: rgba(128, 0, 128, 1)">0</span> newly installed, <span style="color: rgba(128, 0, 128, 1)">0</span> to remove and <span style="color: rgba(128, 0, 128, 1)">144</span> not upgraded.</pre>/ G* ^0 Q+ u* c' \& H
</div>2 e. f0 Q; s* y9 F% q
<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>
( E* ^( ^" O% M2 @) W1 q<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>
) W6 W# s8 k7 v) w5 C' B<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>, k _. H5 S+ u9 J" ^& Y
<div class="cnblogs_code">5 \. e$ U) k7 A7 P* }) H1 m* v, Q/ Q
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)( _9 ]* N' ?' g: t3 c
</span><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">source <(kubectl completion bash)</span><span style="color: rgba(128, 0, 0, 1)">"</span> >> ~/.bashrc</pre>
7 I1 b- D! s1 s) G6 e P& c( h</div>$ U8 T1 \+ Q% S/ |* k
<p><strong>Zsh</strong>:</p>
, S- v- ^4 |% R<div class="cnblogs_code">
6 v& V* R) F6 a<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
8 x6 \! `0 W0 _0 I" B/ w A</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>7 f' z% G2 e+ O
</div>% M* m9 K& V5 o7 c2 `
<p>配置后就可以通过Tab键自动补全命令啦!</p>& c r( U: d6 S' X ?
<p> </p># s; e6 z. }+ N* X; w1 k- D
<p>二、配置kubectl别名</p>0 @. m. Y& M$ H% W0 R8 Y
<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>% l5 P; @6 X4 r/ m* j
<div class="cnblogs_code">
9 ]/ K- C; R; U' ?<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)"># Q7 ?# Q% v( L& S
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)">
0 ~& q- d2 F* f5 C- M6 p, s8 _6 malias 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)">
; m! L' [3 E# a! ], Galias 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)">7 C5 r9 Y. u: I; q4 ^# \
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)">
7 r: p+ C, d1 z/ i' T* falias 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)">
9 V2 J! o0 }; A4 T! Halias 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>( r) ?! @, U' O8 S6 i7 O
</div>! e) n$ e+ U7 K* 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>+ t" C2 L/ W0 _5 {& ]/ q) l
<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>
! n7 t2 U+ U! d* g1 n$ c<div class="cnblogs_code">
) {9 ]$ w Y. m2 \$ r+ T+ F<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml% l& P) y/ C( {) z( I
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created
/ N3 Z; G2 V4 t& u% G- z. a: g$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods
0 W8 _9 L1 h9 w7 rNAME READY STATUS RESTARTS AGE
+ Y7 m+ a; n" O' e8 l9 {! [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+ e$ S4 U& O2 ]3 B3 _4 _# [
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
' V) a; f& D8 \6 WName: webapp
/ F3 K. [' ]9 R* a, P+ S4 DNamespace: default: Q& C4 @3 Z* r* M
Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
8 R. i( C! o2 k& m5 D2 kNode: 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)">" C9 ?5 Q& P4 v: j2 Z
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)">) d/ C/ l$ ?. e9 V7 ^ ?
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp7 b, Q5 K5 \/ z( y- R/ F
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">
5 i8 u& c3 Y$ b6 c+ J4 j, JStatus: Running
$ _# G4 |1 L6 t" W2 CIP: </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)">- T7 _9 U& D5 m1 v" n7 ^, g5 E5 @# f( A
IPs:2 P% B" X1 f" m U) T" Q0 L
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)">/ E, ~! e& f: k7 Q
Containers:* J! P2 N* K( q R( A. d' P* ^2 L! d
webapp:- x9 x' D, M; T1 Y, B" Q, @
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>
6 Z3 {! ^, G1 G3 e) b 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)">( P0 {: Z) R- x2 B$ `, `/ b9 X
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>
5 t' ^8 L+ j# V( v9 E0 q Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
: }# x! g" ]# o/ g3 N! I& p4 z Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
/ x* _- D! h) e+ Z4 b$ z2 F, Q# e State: Running% n& j) }& l% ]: g" R5 B
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)"># ^% ?0 j$ V( M1 L
Ready: True ], [- }2 a0 W6 a5 ]) d& U
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">* _% @! V; S8 u7 V& b( O5 l
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">" n/ s2 [0 a8 L2 o
Mounts:
- n: F: R, i1 s </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)6 ?" g3 H8 L5 @, {; v1 o3 Z8 Z' c
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
4 @9 X# m3 @0 z; w# _ Q. g/ {- g busybox:3 P& Y6 x. y4 E- z2 k# [7 A
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
5 G; W' {2 P3 B2 L6 }4 g<span style="color: rgba(0, 0, 0, 1)"> Image: busybox2 {% j- n2 m4 s7 u5 S
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># U9 }/ t, ~; n% ^/ D( U
Port: <none><span style="color: rgba(0, 0, 0, 1)">
5 ]+ H* M- L2 g9 s Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">
0 |/ O: V9 V# z% N0 w0 K Command:; R' c8 [" n; k& `% K9 I* ?
</span><span style="color: rgba(0, 0, 255, 1)">sh</span>
/ J8 w) h, I/ o' ^7 c5 ` -<span style="color: rgba(0, 0, 0, 1)">c
: t7 D2 G; O' O! A </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out
& z# B, W! ]$ M. Z& ]1 v; H$ C State: Running
! A$ A. }' I0 i: G" z- H 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)">
, E8 l3 b; }: }4 \- J1 C Ready: True
4 F& A b. f: R5 u& J" K Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">% L% P6 A! b3 [' Q" {
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
# l9 {5 S+ \& s; \5 V& p Mounts:6 L6 n( Q( i4 X* d/ a7 i$ Z
</span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
9 M6 q( P/ J" R5 C+ H </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)9 u, ?. M O1 h5 W8 W, p
Conditions:
3 S$ a# s; b, M9 } Type Status
5 t$ \3 K! K7 \" i* v Initialized True
4 @; \" M' h* U; O) _4 N9 o! G Ready True# m! p& O$ X0 l0 D
ContainersReady True& B8 M0 |1 j6 M3 e9 w7 a3 s0 D
PodScheduled True" U1 X8 B7 y# D# ?5 g+ k+ c
Volumes:( ~' G4 M- m# G( _1 k4 y$ \ x
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:3 P* G/ `7 w6 `1 e1 v9 Q! n4 ^
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>* @& E0 Z% g8 `0 T) H6 m
<span style="color: rgba(0, 0, 0, 1)"> Medium:, B/ ^& R4 C+ w$ i0 u
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
; b& w& G9 l5 p/ z! q$ y default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:
# `: S+ |5 k+ |. \& e) w Type: Secret (a volume populated by a Secret)
: B) t; j6 y" V4 h) f2 |0 A SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h) G' j& g6 j3 Y- L
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">6 x: S2 u) {: G% l* `+ ^$ D# _
QoS Class: BestEffort; {! Y3 Z0 E+ ?: f
Node</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">/ I1 l' y6 u3 e
Tolerations: node.kubernetes.io</span>/not-ready:NoExecute op=Exists <span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> 300s$ f: L% V/ a: d4 g) H6 S
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
8 Z Q a6 ]; A0 fEvents:
& R! @/ u- |) v0 n1 {- z' z5 e Type Reason Age From Message
- q- O' b- L, ?) F r </span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">: {2 R" e9 l6 M' o& H u; l
Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato+ H/ J+ ^+ V6 U4 N( t+ E
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; R% A! `; W7 J. f. O( S
Normal Created 2m21s kubelet Created container webapp
/ j" C- F+ [% {/ s; C: S Normal Started 2m21s kubelet Started container webapp
+ d) \8 m- ?) v2 }/ d) Q. b 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 b, O& I# G. q, g 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
9 p/ F$ t" P% e Normal Created 15s kubelet Created container busybox, i3 M0 X" Y& e! n+ R5 y2 r1 n4 S0 e
Normal Started 14s kubelet Started container busybox</span></pre>2 @/ e3 ?$ U9 o7 p# l* i( I
</div># R4 _/ F) g9 d7 Q
<p>真的是飞一般的感觉!!!</p>' R; l: X# U& Q; [( M: R" @
<p> </p>* U0 e' W/ N6 y4 ^! E3 z' K
<p>三、Context和Namespace切换</p>
4 i! q% i' X+ P) [2 L( Z<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>
0 p2 h- z C2 k0 f<p>kubectx安装</p>5 X. T8 N% G. _, f
<div class="cnblogs_code">
) g/ {# a2 B! b& S+ Y7 D" f<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>$ Y# N! B3 f/ @7 `4 k! J3 I
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)">...: ~) ?2 w/ J7 w4 Y
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)">.
3 q+ R+ }; u1 p% X1 b5 U8 W9 Mremote: 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)">.
) ~1 ^5 t' F$ G$ Dremote: 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)">.* d) H+ }# ?4 u% o4 e
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)">
7 i: E7 O" ]+ ~* |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)">.
- u( R: Y! f' A6 k" w! G/ `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)">.- X- F' n# q2 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/kubens /usr/local/bin/kubectl-<span style="color: rgba(0, 0, 0, 1)">ns& I. {" e8 R+ u6 _( }& @
$ </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>
9 h$ r; d1 q) G</div>" a4 L" \5 u- e( |: j% u
<p>我们来看一下效果:</p>/ [# E. z% M, S0 E( Z: D7 `: C( _
<div class="cnblogs_code">5 w' [/ x6 u& g* E
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx
1 Y0 g* Z$ t- v+ cminikube
& }4 f" n9 |4 p$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube
u! s6 S/ \ ]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)">.( D" K( |1 R2 X# X" y* F& O0 G
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
' ?* q& j& W/ J0 w/ o+ [* c' C9 Tdefault; L1 ^( ~/ D8 {9 l7 N9 \& H' P
kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease9 G# q; z6 e8 i* z7 w
kube</span>-<span style="color: rgba(0, 0, 0, 1)">public) }+ m# U3 z5 p8 M
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system; G3 Y3 E9 f4 F Q6 H
kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
c [8 o3 n+ V$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public8 `5 R! M' q3 T1 s
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.
( J# \0 c3 z" ], f$ N+ c0 A- {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)">./ U* W0 p, F/ z5 d& V3 ?
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default
: c2 x- s7 P Y# w- TContext </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.
a7 ]. t" t) [7 y$ _$ gActive namespace is </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">default</span><span style="color: rgba(128, 0, 0, 1)">"</span>.</pre>
( P: W7 t& m8 g$ q( D9 ~</div>
2 Y( u. a$ O) B% s+ F9 r<p> </p>
* d) T& n, K$ L/ p e4 M<p>四、跟踪查看多个Pod的日志</p>7 ~' E8 S/ E1 ^$ p L1 g+ B& P) g. a
<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
5 H4 @% R; N4 b. T% q" z' C<ul class="list-paddingleft-2">$ e N+ R* c) k8 s7 ^
<li>: w# s3 a# x V! _
<p>允许使用正则表达式来选择需要查看的PodName</p>" ? J0 Q4 I- X' F4 r2 \6 }. U r
</li>% w6 ?7 P0 l- c
<li>
8 t+ K# G0 M9 U+ X% T) I<p>为不同 Pod 的日志展示不同的颜色</p>% G0 y9 B' X; _- A; c& x
</li>
% S1 U2 u' \" ^. z! E<li>
# S) _* s& H4 _, Y) s( G3 ^<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>
2 a7 R5 X- ^- Z* s</li>5 g! N4 Z+ j9 f% }, d% S: U' r
</ul>
. n: F, E% ~9 P<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>
6 a6 s; I6 b$ i( q! u/ D% k8 T# `/ }8 Y<div class="cnblogs_code">6 G1 b9 f% A, a: i" X
<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 n% `% H: f7 s/ @4 `( q<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>% F+ k0 S$ u, x' W- n
<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>
3 x$ d/ f4 g6 M" f' t, N) @</div>
) A+ i7 D6 J- g( K/ K6 t- B' t<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>
7 Z( [# x+ b; P8 {+ V* ^4 z<div class="cnblogs_code">$ u1 z5 H8 S1 _
<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)"> .7 @$ A# a/ `6 N+ }
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
* Y+ s3 X% S( Y0 y# ?</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp3 k' t% _6 D9 ]& d$ X, s
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)">]
- z6 g; I7 u" A+ S u2 ?/ 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]% b8 Y, l8 k8 E0 _- U
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">]' z X1 p y. q. c% o/ p A
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
# d: K% k7 @8 v* i* ?5 e0 l0 u# \- 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.325</span> [INFO ] [main] [org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext] Root WebApplicationContext: initialization completed <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">2952</span><span style="color: rgba(0, 0, 0, 1)"> ms# ?5 n, [+ ^9 i- ^8 [+ ~
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)">
( W7 I% |4 l6 o3 \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)
. S: F& _- J1 {3 awebapp 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)">]
' O6 q4 y' t2 A/ N6 K2 bwebapp 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)">
- H) _ A' B. L' o. W& a4 E8 q- Swebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">)
& c9 v7 o2 d9 v4 Y9 u* F8 qwebapp webapp
" R+ |7 e: q4 k' `- @" ?! Dwebapp webapp . ____ _ __ _ _
% _- a, k2 g- f; A0 t7 qwebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>
m( W4 y4 W: fwebapp 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>) y3 E( n! X+ ^$ d- ]& r2 M J
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
{# d5 f$ W! I5 m5 N7 q) Kwebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>$ y; n1 N2 q* {1 P1 ?
webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">+ h' e9 m: c! x, H7 l3 }
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)">)
; s7 N+ e+ b( C4 O$ X0 g$ _* zwebapp webapp
3 \+ R) p' {% l ~webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)7 n$ F4 |$ g. T6 u! 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.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
+ p( ]( W+ F+ s1 Mwebapp 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)' k% O' g; k+ ?$ Z x, o
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)">]( n" f& n# H5 v( D$ x( ~
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
$ T: W$ i5 F* c8 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)">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)">], F" y5 `' z" }3 {( a3 A
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
- p9 P# v: M6 M0 K6 D7 `" H6 N! Rwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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! S" X& Y3 _. r7 d5 J0 k9 k 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.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)">
% S9 z3 y d' U* e3 Swebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.264</span> [WARN ] [main] [org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration] Cannot <span style="color: rgba(0, 0, 255, 1)">find</span> template location: classpath:/templates/<span style="color: rgba(0, 0, 0, 1)"> (please add some templates or check your Thymeleaf configuration)
8 U* @8 e5 F# x+ @* [4 B5 e" s' 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)">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)">]. x/ x$ }2 H; F/ I; u1 H: {3 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)">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)">: D$ T, d. ~3 _, ?$ C9 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)">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>, Q" H+ }6 F* w. N; ~4 B3 b
</div>6 `7 [3 C8 H3 B4 P- _' x
<p> </p>: i, d+ J( H; w) Z8 p
|
|