|
' `2 w4 p6 i3 p+ S0 |& c; k<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>, f; K R; M" z2 n5 f0 q
<p> </p>+ c* `$ `: T0 A, |3 C; t9 W
<p>一、命令自动补全</p>) D* d( p( _4 `# J5 E1 f, O
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>3 {; Z! ~: f9 V. ] ^
<p>1、安装auto-completion工具</p>
& a3 k& B L0 _<div class="cnblogs_code">
( w8 m/ W0 l6 |! v. t, ~& l5 k<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update6 B/ B- s1 E: v, i* A
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>
; m! y5 l5 b, P. MHit:<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>9 e0 v. `( V- e' p9 o( X9 ]* u- }5 c
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>
+ e4 M2 ^, _* NHit:<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>8 N) Z$ Z6 ^- R; D
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>
9 a9 g9 \2 @5 {- |<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done+ g+ [ v4 W' P( T) Y
Building dependency tree
: w# J) L5 E# e/ [Reading state information... Done
6 ^. Y3 r9 U9 T+ w+ J</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.# l; {2 \0 ~$ L# c
$ </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
+ M& E6 W, [0 O# N2 f. I3 \7 RReading package lists... Done
' ^7 u& {' f3 Y& R" u% @Building dependency tree S( f. s$ A3 H( D
Reading state information... Done
/ J! Z! w5 ~9 \' {5 hbash</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).
4 S$ B$ n$ v* C) b+ g6 d; {. P</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>
; b! r) J. O4 `: X" i</div>6 O" V0 Q" B9 r; {
<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>! {) k! Y0 w" a4 x5 {) G2 F0 q: N0 I
<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>
6 h v+ w6 [7 x: t: I3 J<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>
: O( S& u& j: S+ Z9 R<div class="cnblogs_code">8 q8 x' U& Q% Y1 Q8 \
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
2 l( k( a) r( ^3 K</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 \. r& U. b; j
</div>
5 E* Z. c1 M# q1 p/ i& B<p><strong>Zsh</strong>:</p>
% C" R$ U, m7 k! d( Y9 M<div class="cnblogs_code">2 H- {$ ~. y- u3 I
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
/ L- _7 x% U# m8 H</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>
J' R4 `% z. J. }2 \</div>
* K$ R$ e$ y3 a3 o2 c/ Y9 [<p>配置后就可以通过Tab键自动补全命令啦!</p>
5 D! u( E; i0 N<p> </p>
' T8 {# d! \% J$ K<p>二、配置kubectl别名</p>1 ~* F" l. C( E4 o! U
<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>0 k, i- Y5 a1 ^" ?6 {7 A
<div class="cnblogs_code">
% j% b5 _" w8 a& z. ^ ^<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)"># j5 d! A$ @# g+ u
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)">3 z: q& M2 V) m" c+ S8 Q, G. R8 R9 Q
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)">
+ k% E9 m1 \1 `+ E8 {7 r- palias 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)">
+ Z4 x: y* O8 ^2 Xalias 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)">
S+ A& x7 o& m$ p; Q" z6 {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)">8 D0 l" D9 V s, R" n6 b
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>
( M, p% f V) n0 K) X- K</div>0 o: v" e+ ?# \- ]' q# e) ^& h
<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>; v/ ~+ v; Q# O7 F% a. G% y
<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>
1 G2 F W. a( r! F<div class="cnblogs_code">
z. [! @1 m4 P* b+ D3 U- b5 f$ y" f<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml
' U1 x3 y) g9 w4 A; Dpod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created$ v* u1 E- ?- i8 A, i- K5 f0 m; c
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods3 C- }. u7 g6 n5 ~* B; Q/ m
NAME READY STATUS RESTARTS AGE# U# R8 n2 @' b. J S0 @! d
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
4 _- X5 Z4 G2 r0 R5 C6 k$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
W U& d C( Z+ l, q }Name: webapp7 N* I) T0 B* M
Namespace: default
3 H2 v6 F1 x9 h, T6 d. y7 Z2 {Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
0 ?" g) H+ I* B1 B$ s5 F* Q/ jNode: 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)">1 z# T/ `( T) i- x- W$ J1 Y7 K
Start Time: Wed, </span><span style="color: rgba(128, 0, 128, 1)">09</span> Feb <span style="color: rgba(128, 0, 128, 1)">2022</span> <span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">44</span> +<span style="color: rgba(128, 0, 128, 1)">0000</span><span style="color: rgba(0, 0, 0, 1)">, s( u3 Q9 z) A- c- Q( W6 }+ p
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp* {, [, P8 E7 \, {/ g# i. h1 d L3 J
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">
" I- _, [6 c; F! g/ [Status: Running
! [8 Q# ~1 ` w) EIP: </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)">. k! O/ m. [- S( B
IPs:) l; W" _1 V8 l# {$ 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)">. I2 }2 y# z4 k$ w
Containers:
8 B9 b+ b! j1 f- f webapp:
W9 s& V; U' X2 e6 ?& T Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>+ U% _. e! G7 s. ~: K+ `6 U# A
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)">4 d2 p; o5 z" @) \2 L
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>1 G, y p8 z6 O6 u( ^/ J: q7 M8 N
Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP! `; O1 R8 R+ `1 F. h5 V) n
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP9 j, E U h9 z2 K- }
State: Running
6 U8 ~4 U$ Y7 l% H* 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)">
3 z( ?3 O0 ] N5 f7 W! u. ], ` Ready: True0 L* O6 C, V; u8 g; E0 a
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
B3 G( V8 g( Y1 x4 } Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
* [ ]: x4 L/ m4 C0 L Mounts:3 R$ E2 \. x; E- t( m
</span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
$ S C/ ?' v1 n! H7 C/ G </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)* A$ |; |, N& N2 _0 V% V- a |- J3 ~
busybox:) f% A+ B X5 h7 q' C
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
3 c- C+ N$ q# V4 E& Y& Z<span style="color: rgba(0, 0, 0, 1)"> Image: busybox
7 z+ T+ U8 \1 x' L& C g8 U2 q: f 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>% H `6 O1 g; G5 h* K2 M) j
Port: <none><span style="color: rgba(0, 0, 0, 1)">
4 U9 O7 r0 l1 d Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">
& t6 I; Q5 E; X- K! b! A D9 W Command:
, D* m9 X' B2 I. a </span><span style="color: rgba(0, 0, 255, 1)">sh</span>
m2 `) F' N+ [1 w -<span style="color: rgba(0, 0, 0, 1)">c
* @# w. b u2 p- X9 W9 }, n </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out
& U' l; f p; g State: Running% [ d' H1 O ?9 a1 h4 O9 M" \
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)">
& { m! c# ^- W) ~0 k; {) { Ready: True4 B/ ~' }! @3 t! K* J' u, l
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
7 z4 @7 ]$ ^9 ]$ g$ B) | Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
' k/ ~# k* m# q4 K Mounts:
q# B8 j8 u" f* _4 F' V) O( l </span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)' A, k2 |1 b8 g5 T. u! B
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
1 P8 R( T5 z8 U8 l: p ^Conditions:8 d: s7 E( r/ Y0 q: I! I, ?
Type Status
/ l6 P* L) G+ B0 Y+ b4 w Initialized True
& M; j, F% Y+ v9 @ Ready True& s- A3 H/ Q# N
ContainersReady True
: B2 k+ G3 A- c j PodScheduled True. ]! H. o# ~* h8 \& x
Volumes:* T0 |$ a3 P8 p( @
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:5 Q7 V/ o9 m9 q7 e( O4 i+ a
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>
; S) Y q* C! B4 ^8 v1 {( ^" K; F# I/ f. m<span style="color: rgba(0, 0, 0, 1)"> Medium:4 M0 z6 r8 w( p) x3 S8 ~
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
2 C2 K2 D& ^ J3 u% V6 a \& t3 V$ Y default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:
- t0 P* [, I+ T) r$ B: M7 n/ Z: J Type: Secret (a volume populated by a Secret)8 z& N5 A7 |; ]; ]0 r5 n
SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h
+ `+ U) {# E, R( j& q% m0 l/ C1 ` Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">
1 S" t3 }# r7 s. P9 H# BQoS Class: BestEffort
% e3 z, v$ R& e; C$ ?2 N. \* c$ X6 ?Node</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">
( v% q0 R$ E8 Y! ]! n6 ZTolerations: 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 I' u6 ?( H5 ~ 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)"> 300s4 O7 t" B3 O r2 e' n! v
Events:9 x$ F* i7 @+ X
Type Reason Age From Message9 U/ Z5 e1 M6 Y
</span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
7 [1 w; T/ }8 `% q8 }7 Y+ {( ~/ r! U, ~ Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato4 `/ K4 K. Z3 J: ^1 P4 ?
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
0 @ B& A, ?' l2 m& W5 U2 k Normal Created 2m21s kubelet Created container webapp4 B" k# q& N% S. r$ O2 F. i) x G
Normal Started 2m21s kubelet Started container webapp
9 @) Q5 n+ G% \6 L) d3 c1 d 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)">. H" G( e0 x+ X. W" F" \
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
6 _; g" `3 t% P/ o* s8 ?6 S Normal Created 15s kubelet Created container busybox& F# ?5 K& g$ s$ L# F! ^7 H
Normal Started 14s kubelet Started container busybox</span></pre>
& F3 W% V' c) s7 h3 D! i# H</div>
1 j1 t) ~; [% R. K( f. m1 V# Z3 S<p>真的是飞一般的感觉!!!</p>
( l, V9 e# O/ F<p> </p>
6 c9 S C) W1 x) `# @# N8 {<p>三、Context和Namespace切换</p>$ f. J5 y: s- r8 Q# ]3 n
<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>- q2 W; o5 l( w- w& `
<p>kubectx安装</p>
- n1 M) N% U9 }7 ]* F1 ]0 b" |<div class="cnblogs_code">
: k8 ]: I% n, S2 i<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>
( N. S3 l9 w) @1 d9 A I! ]% |* Z ]0 XCloning 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)">...
{6 u( C3 I% j3 {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)">.: {: k; e% I$ b6 R. m+ J
remote: Counting objects: </span><span style="color: rgba(128, 0, 128, 1)">100</span>% (<span style="color: rgba(128, 0, 128, 1)">172</span>/<span style="color: rgba(128, 0, 128, 1)">172</span>), <span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">.
% ]6 i" ?+ v" _5 b6 Y6 T( J& y& z! M+ S @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)">.! ]' ^3 ^# ?# A8 f
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 K1 }& U/ O3 c5 P0 _
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)">.
A# N/ W" ~5 D) K* B2 zResolving 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)">.
m6 s/ S* W* O$ </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. K0 m1 q8 r0 s# {
$ </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>) b! n6 ]; `* Z
</div>
/ C# z3 e. Q6 m# l<p>我们来看一下效果:</p>
7 E4 B& S- w: I<div class="cnblogs_code">7 E. Z$ o/ ]. N- G. M4 H& m- L
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx$ j! n5 H0 f/ q# j* ~/ p4 W
minikube
; ?7 S* X2 l, y0 d4 j$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube
+ s1 J: o) |/ Q, r0 I% H# ZSwitched 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)">.
2 |" P1 ?6 P- o- a. `$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
; m, s4 L, l* t" Mdefault7 Z/ y3 A. s$ ]/ V! e
kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease* @$ _; D& ^ O( E: O" K: @/ L
kube</span>-<span style="color: rgba(0, 0, 0, 1)">public ^$ n3 M/ M3 A( b7 @
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system
/ \% F, m5 `" Y% \# Rkubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
" B$ E3 t# [0 r& e& W9 _$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public) E8 H* }9 I! U/ n2 E6 S5 z# e: @
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.% c# ?" ]+ S! V! D/ P9 J) T% R
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)">.
# ^* I6 [- P- k$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default+ z; h* s a% } 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.
. n, [$ P M: Y6 xActive 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>" _ \; u5 \* ^. ~7 W! G. f( i1 R
</div>
/ Y- I& n n% |<p> </p>% D4 K% ~3 E- |. I
<p>四、跟踪查看多个Pod的日志</p>5 N! H2 q: \, s0 T4 S$ z
<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
, @8 q# c9 y# q/ {5 h5 _" d+ ?<ul class="list-paddingleft-2">
' b7 v6 e0 ^( f2 m: P- a# Q<li>
, I# _4 [% U9 \<p>允许使用正则表达式来选择需要查看的PodName</p>- T/ Y0 `* @0 o% T8 Z! M$ L
</li>
: d ?2 ^6 P: s6 p3 w/ Z<li>
+ g) @, h6 V4 a }9 R$ w, l<p>为不同 Pod 的日志展示不同的颜色</p>" N2 J8 J) N& t. i- I( S, b
</li>
8 u- u1 E; V) K2 M& w4 R$ {6 `<li>7 h5 l- n# j% w" x( \
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p> `* L4 B6 S2 a- p1 n3 l1 J
</li>3 y' E5 t M' u8 f; y6 \
</ul>) Z) z" M0 Y1 z- h( C' p. O
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>
+ }" {; F6 w$ X, g<div class="cnblogs_code">
( a) e0 K b" Y% [<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>
( P9 D2 B6 j9 Z5 S<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>
: X$ T5 }* i7 M, v) H1 c<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 M9 L9 C7 ]# P</div>
% v7 z/ ^5 R) G: t: C) n<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>4 l7 x4 v- S1 o% S, C
<div class="cnblogs_code">. s; |8 H2 O {& o! h- `4 b6 S2 m
<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)"> .2 @' q: V( ?2 b2 K, V' L
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
& T! B/ J) Z# m</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp( d7 W3 W' x) K8 I9 D
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">]* i# K' q1 s' e5 s7 e1 q
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
; V/ s- z* m- w% uwebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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)">]
( ~# w3 @' c9 I( n% 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.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext7 |7 j# j3 {' D3 P, Y3 L9 t
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)"> ms4 M" d D9 J- Q p! ?0 a& S" 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.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)">) V+ \/ m1 c6 S$ b7 O
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)
( y; j- F1 \- x: \2 X a8 {6 C, kwebapp 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)">]
. R9 D4 Z' L" w, Q% _" p$ O7 owebapp 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)">8 h1 H$ Y( {6 p# 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)">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)">)
I9 J! r0 d9 Z% |- [2 Mwebapp webapp, N0 V6 X1 X" \
webapp webapp . ____ _ __ _ _
+ c# T# P& r* \! t7 E% B* @5 lwebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>) o$ ?' t; q/ h4 l
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>; Z% I! u" j3 p' z0 I( p# m# l$ O) H
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
9 R' p9 R5 U3 H, L0 ], Ewebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>. x2 I% W- y) x& M E/ }
webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
: n* _( t: B3 A8 t* F; C! D' ywebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)$ e6 v: N0 n8 z: x' C" `6 Y3 P
webapp webapp
: y) ?6 P R9 \" C0 @. g+ C9 kwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">50.124</span> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] Starting TodoListApplication v1.<span style="color: rgba(128, 0, 128, 1)">0</span>-SNAPSHOT using Java <span style="color: rgba(128, 0, 128, 1)">1.8</span>.0_111 on webapp with PID <span style="color: rgba(128, 0, 128, 1)">1</span> (/opt/soft/webapp.jar started by root <span style="color: rgba(0, 0, 255, 1)">in</span> /opt/<span style="color: rgba(0, 0, 0, 1)">soft)
- Z( M) f6 W- A8 ^6 U1 ?% G6 Nwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">50.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* X+ b2 |: B4 h/ 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.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)
; n& N+ M+ X/ W( ^8 |6 Dwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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)">]
2 R& j" k) |. s9 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.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]/ W0 d8 e" w+ [9 D5 U: 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)">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)">]
" q- @& h( J; C: Q% V twebapp 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$ E7 E& d# N; E3 b+ N- T" }* 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)"> ms
9 @( A7 |3 X3 v! r# j6 U* D7 pwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.801</span> [INFO ] [main] [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] Initializing ExecutorService <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">applicationTaskExecutor</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">5 E! F) L I$ v! Q8 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)">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)
' z( L8 J6 Q9 c3 X2 c, 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.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)">]4 \2 G6 T1 d* ~
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)">
' w3 ^% d) d2 t& O0 X/ B& `+ \webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.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>) g3 K5 i' S1 T0 a( ?: r$ i' Q
</div>
. {* [, J, l- a2 I- j p<p> </p>- y6 _6 d! ~. j% ^- d$ |
|
|