|
|
# J! g( f5 C" E% m! A9 }<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>
( l$ @' J$ Y! ]- i' s0 _- {% o<p> </p>- ?, e% v$ ~8 M
<p>一、命令自动补全</p>& e9 ~0 i4 g+ T- y. \
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>4 o4 V0 _( o" [( _) s( T
<p>1、安装auto-completion工具</p> B8 A- j3 f% f' ^+ q
<div class="cnblogs_code">/ R6 C* o$ n8 r) W
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update3 O. g g7 m* f( i
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>
% l( \$ k5 u; AHit:<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>2 X3 j6 r: z$ E! {8 W
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># R9 |1 ~: N- q, \" l3 Z7 K7 n/ d
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>
& c% {1 u O# h& I+ J7 D! T) sHit:<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>
" Z# q% Q- Q9 E9 {' i7 {; P<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done
8 s# @" [7 X3 _1 W" Y9 ]Building dependency tree: |: P- f* X% z# V
Reading state information... Done* x8 J/ s8 X5 `- z& k
</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.
( W4 t0 I# D, m2 @: Q$ </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
7 Y$ K. m& ]& @7 i" x4 P' x oReading package lists... Done4 {- D$ J' D$ d. J( W1 c) [* O
Building dependency tree
9 {. z- d0 F; D7 LReading state information... Done
' T0 e1 ^3 G9 f9 o/ {7 b# Nbash</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).
5 w4 U7 _% S# N+ ]: R+ O% b</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>6 b. {7 s- B8 Y1 }4 p
</div>. \1 `3 h) a! I# K7 o* g
<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>! y2 ]' ?" U6 W. \
<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>( Y* _. n- h+ B. j" l- ^, K5 r5 s& l
<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>
. ~% O8 }: R5 z<div class="cnblogs_code">: a, l; }5 C9 s0 S2 @+ `
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
' h& f. `7 A$ s. J) G</span><span style="color: rgba(0, 0, 255, 1)">echo</span> <span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">source <(kubectl completion bash)</span><span style="color: rgba(128, 0, 0, 1)">"</span> >> ~/.bashrc</pre>( |! I( }+ L2 V& v/ X
</div>
6 f. u/ p$ r# m. `8 ]6 f( v<p><strong>Zsh</strong>:</p>
, b# A. E' k8 }0 I+ C5 w<div class="cnblogs_code">
- I) b5 B \$ I- |6 |$ D<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
! k0 u) F+ O0 {# _& T$ J4 z! O</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>
8 e. P3 ? S2 E5 M7 z; }</div>7 T7 a1 ^ q( a' J( d
<p>配置后就可以通过Tab键自动补全命令啦!</p>( w- J" X, @1 r1 d! V
<p> </p>' n( N( L* R- ?2 g5 i6 t: J
<p>二、配置kubectl别名</p>
3 I3 f/ j6 V! p/ d, D( N: S<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
: g# O! x: T0 H* j }2 `2 U2 b) q<div class="cnblogs_code">. H/ s$ s! ~. y& R
<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 P; u( E4 G2 m# V5 ] d# T5 V
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)">
6 C1 Z. E* r$ Xalias 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)">* s) N$ A2 g2 ?, j* d3 h
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)"> D( r9 [2 {. V+ l% Y- H
alias klo</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl logs -f</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">; o, T% X: ]$ z1 a* E
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)">
: r( L7 H* ]: r0 @( |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>2 p# e. N4 e8 v4 c, x/ x
</div>
. I u+ f' Q5 a0 h, |& A<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>8 a' A) g7 f3 Y. G2 H6 p ?* [. E- d! u7 E
<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>5 u( i1 r+ ^+ k; T8 Z9 E: N
<div class="cnblogs_code">0 _" Q# \& R" X
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml8 t* {8 o: M; p" w3 @- G
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created
) o1 v+ n% C( h2 s$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods( l L( H( \& t4 k% s( r* W
NAME READY STATUS RESTARTS AGE- o# Y2 \/ E8 |& 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- f; }& A( |1 z) }; L' C& X
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp# k$ {5 `; h, Y7 E# G
Name: webapp
. g9 i4 Q9 e$ x! R7 E3 fNamespace: default
9 z% _1 ]0 Y H; CPriority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
' O4 @. K5 `* H0 E$ [& |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)"> A& L4 Q' c5 I
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)">* f# M0 [! V' _6 ^/ z. J
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp3 _ G3 o- X! n
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">0 W$ D8 |4 j1 s
Status: Running
7 b0 Z) C1 y G; HIP: </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)">
5 W1 x$ q( p4 p$ r' n% uIPs:0 ]) p4 I$ x- D+ r% c
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)">
# K- k; p: |2 s* ^) ^5 ]8 o, M) i2 u _Containers:% R/ S# w, y2 D: L( s* y
webapp:
: x6 j9 f/ U) A/ q9 p0 Q6 Z0 |* y Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>
# G1 @, u5 \/ d3 U 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)">
T! y! e: f; @ 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>3 o9 E1 n* s: d
Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP4 X( x( r5 j ~* y4 `. p k- ~ h
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP# N( ?8 [) n S* W3 i
State: Running
# P) A: S5 K4 S Started: Wed, </span><span style="color: rgba(128, 0, 128, 1)">09</span> Feb <span style="color: rgba(128, 0, 128, 1)">2022</span> <span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">46</span> +<span style="color: rgba(128, 0, 128, 1)">0000</span><span style="color: rgba(0, 0, 0, 1)">& b# J$ q* [$ \7 i; u# G' t
Ready: True6 ]0 P: l k3 Y: V- e' f0 B
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">) O( m i( C( C5 q; z
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
* O3 K8 L+ c4 _ N, | Mounts:
+ s8 s+ u o& ]* @; D </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)- w+ w5 B& G. i
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)$ V( W$ q5 S7 F' U+ x2 A l
busybox:( b! S9 l4 N: ]( t. f$ @
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>
8 E6 V* E& O7 H8 U( K' \; Q<span style="color: rgba(0, 0, 0, 1)"> Image: busybox2 `+ h6 E7 G# b/ b* S: J
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>
! a6 _8 Y* W/ s) Y6 v+ v9 E8 u Port: <none><span style="color: rgba(0, 0, 0, 1)">/ g" Y- f5 p1 x/ ]
Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">4 Q5 G5 q8 f R( L* u
Command:
4 z0 u5 \$ `; i1 i3 ?1 ` </span><span style="color: rgba(0, 0, 255, 1)">sh</span>
% E2 z3 X( O6 M* z, Z5 P* | -<span style="color: rgba(0, 0, 0, 1)">c+ _% e! t8 Q' d
</span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out0 m7 g. z: o3 a6 y+ ~/ J. H0 s% l" i
State: Running
) |0 t% h! \ K* N# \7 d% X 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)">
2 Q! s3 u) l- J S0 V4 H- H Ready: True5 g5 ^; _7 I' M( l1 N2 }) q
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
: Y& I2 x% u( d0 X0 U" U& l Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
, [) q3 \ t9 X2 z7 H i. V- h Mounts:/ \9 z/ O o) T( v" M% B$ G) G4 X
</span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
9 `* K' T5 Z! m- m) v </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)% b/ V3 x9 x ]
Conditions:* i& ?4 K; t& z
Type Status5 \1 Z; w9 j9 E! l
Initialized True, W1 T, v* d2 c) `! q9 C
Ready True' ~; U, j' I! C! a' k" n
ContainersReady True
' m; w3 h: {! N2 {* D PodScheduled True% R% Y/ I, d' P$ Q
Volumes:; c) _& c( y( m& F# N) V B; g
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:
3 G" k# n6 y) Z( M+ | @9 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>
j4 B B4 x8 W$ M3 i/ O<span style="color: rgba(0, 0, 0, 1)"> Medium:8 f- P* F1 {3 g# ~
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
! J7 [1 r9 b% R& U2 _: y( y default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:
; N1 v; k9 T% u+ L; z5 I Type: Secret (a volume populated by a Secret)
. o2 u. R6 `7 c4 l- U SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h
1 m+ C$ N: x+ y5 x7 Q. m Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">3 k i( ~$ e Z* M( f8 p4 A6 ~1 W
QoS Class: BestEffort
: G3 }# |( k* l# J4 `2 ^- uNode</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">
! _& ]1 ^, w# }6 ITolerations: 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 N% Q* n) M% r" C u$ C
node.kubernetes.io</span>/unreachable:NoExecute op=Exists <span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> 300s
! E* }2 y4 B0 z5 LEvents:) u/ j0 z `% a1 J3 P
Type Reason Age From Message
8 I! E! ~) K2 ?0 v$ W* X0 {3 r </span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">) {. L/ E5 Y/ _) ~4 Y) f* R, U+ z
Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
$ j6 F2 L- Z* ^ 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 machine3 x: j$ y, j8 W7 s
Normal Created 2m21s kubelet Created container webapp
) n' n1 t5 D5 m! J! Y! a0 g Normal Started 2m21s kubelet Started container webapp7 G5 T! i: [7 \( N' b8 [
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)">
1 p2 z+ m. L% I* ?3 U" g- z6 r8 O 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
' K5 z. J. ~5 L Normal Created 15s kubelet Created container busybox, o; l4 a5 v, W9 v
Normal Started 14s kubelet Started container busybox</span></pre>
4 Z9 D c4 P5 H1 B- b' I, r</div>6 l: u" E( `0 L, }# C7 U
<p>真的是飞一般的感觉!!!</p>
/ Y6 N9 n7 H' W+ u, Y- G, G<p> </p>
7 [+ p. W4 v* {1 e<p>三、Context和Namespace切换</p>
# ]3 B# m# v `7 Q# Z<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>- c ]8 D) J: f* A+ h
<p>kubectx安装</p>/ L9 \9 ^7 |* W% b
<div class="cnblogs_code">
# d( \& P! z4 K( z4 t( j<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>3 a; H" C1 a3 M) D0 M
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)">... v$ `' Q" j3 x6 ^( [7 i( z/ @
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 t) X: B( R) n8 N- D1 c
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)">.8 ^, o P8 [$ p( |, u
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)">.
" t4 r5 {; k) B. ^3 Yremote: 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)">+ B K- j, `$ E# `5 A8 l& {" y' T
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)">.6 c5 Z) _ o7 ]9 v, l3 }
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)">.* ^/ x8 x1 J* T& D9 V
$ </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)">ns2 R3 t/ l( b# Q7 ^, l6 z
$ </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>
+ j/ b/ q$ s2 N2 }& D/ ]! W# B</div>
0 f$ N i' |+ R% q<p>我们来看一下效果:</p>
! `0 {$ `, N+ D9 u4 Y<div class="cnblogs_code">5 |* i& k* i) q' r+ ?
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx
2 u! x0 Q3 D) Rminikube; Z* R' o! T H- g: Q$ X
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube0 j/ Z7 l8 H( u* d$ z# w8 t' X+ A: {
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)">.
0 `9 G* o8 P1 E/ q$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
- l. J. y/ q! b3 o mdefault
* E: _+ i3 Q1 Z6 fkube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease
/ c; x" o3 Y& T" l, Qkube</span>-<span style="color: rgba(0, 0, 0, 1)">public
2 b+ w' S7 j; ?; t& J8 q, Ykube</span>-<span style="color: rgba(0, 0, 0, 1)">system$ x7 q! s* j) U+ |1 {
kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
8 l" z8 `# T% H$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public) v4 g9 }( i5 I, L0 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.7 I1 s, E* q K2 ^
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)">.
: M- Y$ r9 O# S7 F5 W$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default
) R1 j7 h/ A KContext </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.
5 [+ i* ]- z1 }9 m0 j$ M+ eActive 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>% e3 V' r# {! H. Y/ m: G' U6 I
</div>6 n' J8 m2 w7 } ?
<p> </p>
: e; n; J* m \* T<p>四、跟踪查看多个Pod的日志</p>
. _* ?0 B# ] T2 h* x. d<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
& o2 i6 b `6 H* I2 Y- F% E5 B<ul class="list-paddingleft-2">8 l/ H- j7 R5 H0 o* F1 ^- v
<li>
0 c* u, V, s; z: M% C' r) }2 E<p>允许使用正则表达式来选择需要查看的PodName</p>8 `' {* X7 K; x \0 e9 f7 X7 M
</li>
3 `! h% f) [4 v<li>$ p0 d5 ^# x/ r+ t8 |/ t8 k+ x/ c
<p>为不同 Pod 的日志展示不同的颜色</p>- e7 D# H7 ~4 H, l2 w& N
</li>6 l9 Y. r1 L+ B$ ~* J
<li>5 l( n# p0 Q+ G2 @: M: b' f( s2 m/ D
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>' a. U5 J0 j" \ x
</li>
1 ], e, E* K, Y2 [1 b</ul> \& _* [7 \' P8 \% N) e4 R
<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>5 _6 p6 b( a* w( K
<div class="cnblogs_code">
* m) F# r$ I; V( S4 F<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 }8 P5 E+ l, |. m<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>
* b9 q! |$ f: r5 P$ Q) z+ 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>( s0 \1 X2 |& ]' p% S
</div>; v# J' o% |: D: H! E' |* Q+ V4 I: b
<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>* K2 q( Y7 Y5 e
<div class="cnblogs_code"># E; j2 i0 E" m2 \3 V2 J
<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)"> .
" H! R' J! w6 W) O</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox V, t' k' T) N: T8 h" Z- w4 J
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp7 z$ P5 |/ |8 T& Y
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)">]
+ m* p2 P- K1 h1 ^7 K- | F9 ~( u: Hwebapp 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 b9 n5 u0 }; ^% 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.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)">]
0 }3 d0 v; O. {5 o% b& L+ 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 WebApplicationContext. }( I# o( r- J0 j% b
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.325</span> [INFO ] [main] [org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext] Root WebApplicationContext: initialization completed <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">2952</span><span style="color: rgba(0, 0, 0, 1)"> ms
5 P# w0 H) w% h( w7 t. 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)">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)">
$ O9 a6 v; f1 \- |* @7 o5 k# V3 iwebapp 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)
$ r2 L: V5 a# ]3 V& \8 Lwebapp 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)">]
x- y* D8 m) B8 h( Wwebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.481</span> [INFO ] [main] [org.springframework.boot.web.embedded.tomcat.TomcatWebServer] Tomcat started on port(s): <span style="color: rgba(128, 0, 128, 1)">4567</span> (http) with context path <span style="color: rgba(128, 0, 0, 1)">''</span><span style="color: rgba(0, 0, 0, 1)">
+ v }% {+ Y- F/ uwebapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.509</span> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] Started TodoListApplication <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">6.235</span> seconds (JVM running <span style="color: rgba(0, 0, 255, 1)">for</span> <span style="color: rgba(128, 0, 128, 1)">8.074</span><span style="color: rgba(0, 0, 0, 1)">)* x3 h) z8 D) Q4 M
webapp webapp
% Q6 F5 {, K9 u5 ywebapp webapp . ____ _ __ _ _
) I1 Y3 z+ g7 I+ \webapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>
T0 t4 Q: M j- V; x" }( dwebapp 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>
% u4 ]$ H$ T. D9 vwebapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )4 c6 C; U. ] |4 j" r4 o+ c0 K
webapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span># M; L/ G& B( {6 r( |6 A! r
webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
9 X, K# H7 ^) u; h- S1 Owebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)! a6 f# S, ^% M w& a, o* V; c
webapp webapp, ^9 F2 Z( w7 F# }9 s! 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)">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)' g: j; L# X; X4 U8 g' ]$ P! o* C
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">50.165</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] No active profile set, falling back to default profiles: default, H6 K* J% `6 w4 ~. W
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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)
0 B. }+ b+ ^! [/ V, z: ]/ Iwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">]5 |9 Y& L& l8 G; ]2 [8 H2 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]! X: o% p' a& A/ r! w
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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)">]
8 J: R& H 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.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext
( [/ I( ]4 D8 P/ Y. x# Y: {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: B. \ C8 r1 d3 D2 |# d5 X7 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.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)">
7 @. K7 {1 S( w3 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)">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)! {) r! i9 c# ]
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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)">]! e+ G, Z3 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)">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)">
) B: w% o% x( B( R. }/ 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)">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>% @1 O! _: m* W% ^( L1 F
</div>
: J& Y9 g' h: N0 D( F. T" C<p> </p># }4 T$ ?, o9 N+ B9 b# e
|
|