|
|
. W# O% V3 y. h8 f. a7 S; b<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>* l; J0 z% \6 C3 p# b1 }, V' \- ~
<p> </p>
& U4 I5 i7 J. r4 M6 K<p>一、命令自动补全</p>+ R- `+ Y4 n+ Q4 k. g
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>
5 }/ b* g/ [9 u. d7 N<p>1、安装auto-completion工具</p>
+ w7 k9 T, Y; m! Q4 [6 z; ]8 U+ Y3 P<div class="cnblogs_code">
6 t1 n' H' s) s/ r/ U# n<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update
8 N6 f7 `1 F' D3 Z8 @+ HHit:</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+ A6 o, [1 g$ l. nHit:<span style="color: rgba(128, 0, 128, 1)">2</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">security.ubuntu.com/ubuntu bionic-security InRelease</span>6 I5 M |1 F4 q7 t2 W; n9 ?* }
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>
4 j/ B# N: v0 I# ]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>" t3 K, z2 B: }& w& y
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>4 G0 o) o( u1 m3 I
<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
4 v( ]+ G# M) E5 O( PBuilding dependency tree: p. l" _- T3 W( L9 ]
Reading state information... Done/ G5 f- s- k x' s4 x' A* _8 b
</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.
* k' ?; L' L$ n3 l7 D& s$ </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)">completion6 y: h% o+ ]- k1 P3 f' P
Reading package lists... Done
3 t8 v! a" Z6 xBuilding dependency tree
3 q/ m+ A* `; [, _Reading state information... Done
! {+ b. j* t' e" i% q T9 {bash</span>-completion is already the newest version (<span style="color: rgba(128, 0, 128, 1)">1</span>:<span style="color: rgba(128, 0, 128, 1)">2.8</span>-<span style="color: rgba(0, 0, 0, 1)">1ubuntu1).
/ A" P( x, M" p' A7 u) K</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>' h# s5 C1 j# w. [' _3 o/ ]' a
</div>
& Y8 T6 D; A$ f+ A# Y0 ?; [! I$ N<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( L/ i, c* E4 w0 G5 J( R
<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>$ h% f2 p& P3 {3 t8 ^5 \3 c' V
<p><span class="js_darkmode__2" data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)" data-style="color: rgb(0, 0, 0);"><strong data-darkmode-color-16446330660319="rgb(163, 163, 163)" data-darkmode-original-color-16446330660319="#fff|rgb(0, 0, 0)">Bash</strong>:</span></p>9 J f) g/ b. M2 X. ^ E$ Q
<div class="cnblogs_code">& c9 ]& N- d r f' `' f2 V- P" s" v8 a
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
6 n {4 p ~6 n</span><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">source <(kubectl completion bash)</span><span style="color: rgba(128, 0, 0, 1)">"</span> >> ~/.bashrc</pre>3 l# G8 z# X, l& |1 Y
</div>
% y# ?. @! |% r! D0 W! V# i" R0 Q: S<p><strong>Zsh</strong>:</p>
5 G7 L4 o9 X! Z* }, s<div class="cnblogs_code">
( [+ S# m5 g2 `6 a; B2 p; \/ k4 V X<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
) `5 H5 v- X+ L+ U4 W3 h% O5 q9 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)">[[ $commands[kubectl] ]] && source <(kubectl completion zsh)</span><span style="color: rgba(128, 0, 0, 1)">"</span> >> ~/.zshrc</pre>
+ }4 J, ~2 n7 [ P% E</div>
% d2 y6 E* y+ |$ i8 T# V# |6 O<p>配置后就可以通过Tab键自动补全命令啦!</p>
1 }! H% L" V) x& Q* @& y" s! F<p> </p>) H5 t% M1 M5 B( o
<p>二、配置kubectl别名</p>5 c0 O" P0 g0 v4 c' y
<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>* B% ?; M, y) B& ]% l B
<div class="cnblogs_code">% H* p; a3 Q( J- X0 @8 D/ K [$ C
<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)">6 D% N6 ?& s0 k9 F
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)">
+ F% T, m3 z: X, a1 e3 ^& J jalias 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)">- C L; ~. m; n* I& G; e! g
alias kex</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl exec -i -t</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">
! u& t5 r6 N" m' E* @9 ~; F. talias 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)">4 C8 E& C' Y1 D8 V- e, q5 t
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)">
5 l% c( L' t$ e" C+ U" `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>! J* K X0 n! n6 d
</div>
( ^% s# x2 d2 x; S0 c<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>* z8 a9 B3 _" H1 d
<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>
$ T' ]) P$ _, Z& o2 |& c& J<div class="cnblogs_code">+ S8 E- S1 ]9 ~$ K& r7 `+ }
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml
, Y; A- e6 a/ T- z/ `! s- m8 fpod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created
6 {) I# g7 v8 O! z" {$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods" K1 r9 V' ]% x# H6 d
NAME READY STATUS RESTARTS AGE; o1 w) Z5 p ]7 ~* y% x; L1 e
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 `, p( y6 Z6 ]$ h1 Z$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp1 Q! f7 i; E7 m. l7 U
Name: webapp
$ R! w; c: x) _( Y3 W6 u2 g6 wNamespace: default8 X- X3 s" Q% o( q
Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">( x! e- Y9 g O, F% A6 n- C# P
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)">
5 }; }$ D8 X9 U- W, PStart 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)">
7 T: _' c( `* z0 X7 U: M; E* lLabels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp! Z5 m8 t. q9 S& j0 \: w6 C- [
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">7 n1 e ?' F) y5 R
Status: Running) X( w; j# w5 X" R7 O
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)">
1 ]# g: d4 y8 p% E+ L: {/ B8 lIPs:7 E! B" E0 f5 S. O
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)">) u; H4 @7 Q" J' r
Containers:$ J2 c: D8 c! J5 a1 E
webapp:
! _, V) c5 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>
% E3 R6 W9 y: a2 `2 f$ \ 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)">
. R/ I% H* M/ C* I+ x* T7 ^ } 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>& z" C7 C$ A# L: {
Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP& Y9 B2 [$ t5 F) ^$ u. R+ G# R- v
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP/ x! r/ ^5 {$ s4 K# d0 W2 [
State: Running- m x1 H& Z. `7 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)">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)"> K' ^5 G( I) ?6 X* w/ }- k# P9 h
Ready: True* T/ B4 a. |9 l+ K# \) K
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
7 u" J* V) e! N; [" R% r* N& Y4 [# [% U2 ] Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">1 n0 `% D U- p( {3 f# l( s& c4 L9 o
Mounts:$ ?2 q: c# Z& r) ?8 L
</span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)" A" r# ?1 f# h- w1 |& B
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)% P6 ]9 _' N9 ]0 @
busybox:
8 w9 a: {+ u2 H& ]" S$ Q& q( j Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
1 @5 e" ~! u* R$ L- E y<span style="color: rgba(0, 0, 0, 1)"> Image: busybox
8 ]5 c- \# a$ m! @. L 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>. D$ v& b" U# N8 U; a- i t
Port: <none><span style="color: rgba(0, 0, 0, 1)">
2 G- R: G" O& p Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)"> [/ u" a4 e, R' e$ w( ~' Q
Command:/ b0 p4 d7 N/ R/ O5 j
</span><span style="color: rgba(0, 0, 255, 1)">sh</span>
) ], a! i5 k+ L& t. f -<span style="color: rgba(0, 0, 0, 1)">c
* _: f5 T ]7 L* P+ F5 M </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out, h6 B; T7 T- P! W/ ~/ ]% U8 _) \
State: Running
5 X# n+ K( m( r1 v6 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)">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)">
3 z4 J* [, D5 y0 A- V Ready: True9 z w6 E3 U) a* M8 B
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
6 F) _- J. z {! ?/ X Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">: n) S( N/ n, g) d/ i1 w
Mounts:" M5 F2 R, j5 B7 a3 O8 }( a+ V
</span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)( \8 }, W% H1 ?3 H6 V( W
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)4 D; e* s$ }+ I5 w5 O
Conditions:5 O# v! _. A1 ^ B& z* c
Type Status
6 f t9 c0 u- _+ ~ Initialized True9 b5 H/ k) h1 ^* D' B
Ready True3 u4 {3 Z8 [3 v( j* i
ContainersReady True
, g0 g/ @" g7 ~; n3 x' X PodScheduled True
- U$ \; U4 w) n! K0 _Volumes:* c. U& E2 n; m8 j) t5 G4 X4 q o+ l
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:
5 u4 {( d+ W1 @# U2 I: b 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>) S3 t% G; Y$ D
<span style="color: rgba(0, 0, 0, 1)"> Medium:' ]6 J+ N+ w6 F& N
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
+ W2 y9 u* m3 ?" E2 c' z default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:
& E1 [, P+ R! H" ? Type: Secret (a volume populated by a Secret)
) ]1 [$ M, s. l5 ?, [2 M. w8 X SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h: K" w/ ]% T- M% N
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">% J! @, a2 @( ?
QoS Class: BestEffort
~) M( U, a4 j9 R1 VNode</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">
* l# w4 x* x5 |: V+ @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)"> 300s2 f( X0 o9 V M K! I
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
O1 D" e8 G; I/ |. T# {Events:0 N T2 }' c v! L! U5 J, o0 c# x/ w
Type Reason Age From Message9 T3 W/ S2 }3 e4 B! L% A6 D
</span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">* i* z, A: ^% c( T3 z
Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
9 @! I2 A2 j5 {4 {9 K 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 machine1 y+ L' {* z, p9 v0 b$ R" |5 m, ^5 U
Normal Created 2m21s kubelet Created container webapp4 K' i E# ]$ |
Normal Started 2m21s kubelet Started container webapp9 z& }6 {7 w2 y* A. E9 J g4 R
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)">
+ r" ]( Z, b. ^3 u* R# h 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. \4 L8 |0 H$ I7 `, f1 i3 Q. |' c
Normal Created 15s kubelet Created container busybox" r p! E( w- ^0 S5 N' g
Normal Started 14s kubelet Started container busybox</span></pre>: ]9 h" a. i' |
</div>
# C+ ~8 E( _& k/ O" X) p) E2 M A7 Y<p>真的是飞一般的感觉!!!</p>( I& W. B5 q$ X* }* _. R* D; l2 ]
<p> </p>. R8 K7 i' m" i
<p>三、Context和Namespace切换</p>* D# d1 c! L5 H T* J0 G
<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>
/ s) i0 i; H* K1 m5 E" [<p>kubectx安装</p>
0 y$ k9 p2 y0 P<div class="cnblogs_code">
* r3 Y9 i0 C) k! z<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>0 O" {' b$ L% p8 R6 f* @
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)">...0 U. W2 k4 V/ ~# W8 r
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)">.4 C |% t- A7 a, o: {
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)">." C9 T1 l3 D: N" @/ y6 n
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)">.
- g% T; g$ q0 T: o* bremote: 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)">
& u/ a$ i, x8 |, N8 v r1 JReceiving 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)">.
# N/ o" d+ s9 Q& K( 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)">.% }, }$ M. X2 r" N' \) ]; s5 B3 C
$ </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
/ v2 q2 \ H0 _. C$ </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>
7 [- O0 L7 C+ z; c</div>& z9 P# H$ o9 r. W
<p>我们来看一下效果:</p>! x0 q( Z8 y3 T1 ^/ P
<div class="cnblogs_code">3 E4 K! L/ l; z' E, `0 X
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx# S& u9 m2 @( h: [6 r8 m, \2 x
minikube
* y+ o3 Q7 ?$ t2 _% D6 d$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube. A" G, ] `9 m7 Y, X2 e: [: [; E9 l
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)">.! w+ S5 [, N( V) m0 D9 D+ \ y
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns1 H. @4 e: x0 c, C( U# c y# Z2 b
default
+ d& V% P* j; m) f2 {1 R( `1 p n @kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease
% ^; O! I. x- P( v6 vkube</span>-<span style="color: rgba(0, 0, 0, 1)">public
2 O1 U$ ~8 I$ ^kube</span>-<span style="color: rgba(0, 0, 0, 1)">system
# s. B+ }; l2 T. S4 _kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
; O y( Q% b) J8 O8 [$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public i$ n0 B# s5 y* I
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.
$ t* R: U& B! M" a- QActive 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)">.6 O; y i. g/ U' c
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default! f: Z# U9 K7 ^2 J. u
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" O6 j( ]* x( l4 L1 l
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>3 j* v. l- M# A: z
</div>
' Y' t4 T/ M! }6 n( V7 `<p> </p>
& m# D* B0 u+ A. _5 |- `, }9 Y; b<p>四、跟踪查看多个Pod的日志</p>6 A+ L s2 r! B v5 @
<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>! T( m4 l" X8 `+ [+ T$ m3 N
<ul class="list-paddingleft-2">
) G; j# _! _: E5 D: ^<li>/ I) Y2 p% P2 B3 h' I
<p>允许使用正则表达式来选择需要查看的PodName</p>
# B' S* V* h. T% R8 f* V) E</li>$ P* `8 Z2 M4 ^; I x u4 \
<li>
* a8 x2 f- I3 b0 p8 a% k4 r# c<p>为不同 Pod 的日志展示不同的颜色</p>
0 o: Q1 p9 Y( k</li>7 i# N a) G: n. w+ X _2 i
<li>* i$ V% m* a) @8 D! p) _9 @, V
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>8 T# z, d4 f S2 E# F! ?% K
</li>( M9 D0 U) v# [
</ul>8 i. B( g: f0 _8 a3 {9 p
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>& @, t% {/ _% D
<div class="cnblogs_code"># u& \7 H @% }* W, @
<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>9 C% Q0 M. i: U/ F) ~
<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>4 | Z/ b, ~- r- z0 [ K) m# H
<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>
* ~! q+ f$ o; g: f9 J</div>
# _8 a; l9 G1 E, [) m6 C3 w1 x+ ?<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>
5 s# A( g+ ]. S<div class="cnblogs_code">
! B% i6 o% [3 X/ k<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)"> .
6 f, a, c Q b" t</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
8 j; m1 `: b, @! |0 T</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp
! E8 t1 I2 W! ~3 X0 Vwebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">]
+ p* n+ L2 \9 C. ]+ D" @, B* 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)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]8 v# b( K0 W# 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)">]' j* z% w( Z" Y& A+ 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
8 r' Q+ c( J. c) [+ K# 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)">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
& G7 e- A( L V6 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)">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)">
, F% L3 x4 {) n! {2 L' K% zwebapp 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)$ X/ F7 [, I, E b- i1 S5 h
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.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)">]
+ \, G. Q" h4 o2 |7 q+ 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.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)">) A: ~4 t4 P/ r: E2 C! v
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)">)" u5 r8 m( F( B
webapp webapp! ~1 U% o! R4 v- c8 V" {
webapp webapp . ____ _ __ _ _5 j! ^9 @% r* `' r D; S' E! w
webapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>
+ T, X% M2 i4 D" u1 b) z2 P6 Jwebapp 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>
- [0 p8 b% k" `' Xwebapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )! d9 ^4 m# R) Z, G9 V; s% U9 I
webapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>( m G3 y+ |# z
webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">2 @) t' D8 X& f6 X
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)">)7 { s8 E# E% E1 z7 T
webapp webapp0 {0 |, S. p/ T* O( ] w1 X0 \" U
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)
: P2 s6 k+ A T6 ewebapp 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
; f1 G1 G# j2 Nwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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)
f- ~) I2 x1 a* J( nwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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 `$ U( t8 }- m( h( u
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
! u! ]4 k# W/ i* 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)">]
1 }: \+ w/ ^& I( h, H. Gwebapp 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
' S6 I9 i, j% W6 z ~6 p) \webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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 u; m1 I6 @9 i6 t/ h8 Bwebapp 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)">
# C$ |& |- 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.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)# y2 w# @! Y; O. d" 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.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)">]
0 q8 I1 P9 \3 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.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)">
: i5 Y" o q8 D/ [7 r9 r- i& 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)">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>5 c& i% B E2 _5 g4 t2 Y( D" ^
</div>% s3 u: I2 U& }, G8 L i
<p> </p>
* s" p# A( D' E- T# B7 D) m7 Y |
|