|
|
: V* u1 I" T3 K% A8 g9 ]2 g& ?
<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>6 V( @8 n3 b4 n8 h8 H+ \# c
<p> </p>3 w) w& O+ {# t* r3 i: u/ n. h: Q; `
<p>一、命令自动补全</p>
% m: M: V% k1 |# U' U7 C% r$ ^<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>
! v6 w. g+ z& B5 x: }<p>1、安装auto-completion工具</p>, }# Q# ^* N. F+ V' V
<div class="cnblogs_code">
3 Q- u4 y4 R: i6 V N9 W<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update
8 ~9 y5 Z8 k1 s4 j/ sHit:</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' W4 e4 F+ b! H% [* z% \1 {
Hit:<span style="color: rgba(128, 0, 128, 1)">2</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">security.ubuntu.com/ubuntu bionic-security InRelease</span>: f' j) P" e. U8 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>
$ w% l5 J8 C C/ E" S# q( qHit:<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 Z/ Y8 z6 n* ?, e5 [) N1 EHit:<span style="color: rgba(128, 0, 128, 1)">5</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">archive.ubuntu.com/ubuntu bionic-backports InRelease</span>- u; u4 L" O0 m! K' }3 {6 { p
<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done2 N3 y4 P1 z, w- j" `. G5 n
Building dependency tree
+ J8 J3 Z+ k: u9 t& `3 O. }Reading state information... Done- c% C q9 M5 W" N0 G
</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./ S0 \, |' k" E# k# k0 J( A' 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" g8 B# _1 y; v
Reading package lists... Done( N k$ ]! Q% J1 M
Building dependency tree
& g3 G: Z f2 l. lReading state information... Done O1 X. w; H0 U% Q3 h' r. d- R
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). f" Z0 N7 w7 m' q
</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>
. X0 E( S( I8 J! {% m' |# X5 T</div>$ r, c B7 I( t+ N/ `5 b, a3 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>
) c) V1 _* o N/ s5 x<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 a* g/ \+ |+ \2 a<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>2 h3 R1 l2 f7 g1 L6 X
<div class="cnblogs_code">8 n; z! y1 X, m8 l2 i! R' L9 B. Y: x0 y
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
2 ]: r; z: e9 d0 V</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>
9 h0 ^/ Z! r% c* q; \7 Y</div>9 T# d6 o( _% i6 `& W$ Z5 U
<p><strong>Zsh</strong>:</p>
: P9 w9 X2 |3 x8 F<div class="cnblogs_code">
( j0 B& f# a) L( o1 y t<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)
+ f6 W9 q( w* Q8 Y! l7 y1 s m</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>
% |- Y3 f+ j* c9 M" k9 S, g% s</div> Q0 b9 ]/ i! \) q; X9 Q5 E" E8 ~
<p>配置后就可以通过Tab键自动补全命令啦!</p>
[$ C' M c n; Y( b( q<p> </p>. w, g* o, m( u
<p>二、配置kubectl别名</p>% @# h0 \7 Q. \, t! d. k
<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
4 l8 h4 N9 B {/ m% j<div class="cnblogs_code">
: `2 A/ a$ x5 R$ x0 r s<pre>alias <span style="color: rgba(0, 0, 255, 1)">sudo</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">sudo </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">+ Y6 O9 Z( ?3 d& F6 o, n7 v0 g) J
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)">
+ u* ]% T. M0 o2 x9 T) ]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)">
9 _1 ~! {! p7 e, e: Calias 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)">8 A/ Z5 t/ B7 J
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)">, E% n6 s% E7 [0 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)">
# @* y* w1 o! z- G A$ g. [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 x! B2 h, F( q$ h7 u' W3 N0 T
</div>
4 I+ P- A. Y" R- Y: f<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>
' I9 E6 X$ [9 Z$ `- a<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>3 p' e& J* v) d+ D6 T
<div class="cnblogs_code">6 ]( ~% g5 e2 H! C) y, `' ]
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml/ @$ x; M H7 l+ x. Z. Z) B* H
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created
$ _* ]. L$ T+ R" k0 m$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods4 E4 C _1 t* w7 U$ k
NAME READY STATUS RESTARTS AGE# U2 W1 o* ~/ r; n9 \! `' B/ K
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
6 Y7 W! C2 w; H$ {! J$ N$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
; X4 q2 @ U# S( u6 n+ w& Y% tName: webapp
* s: y: I# i& ?. ~% S; E# O5 wNamespace: default
# a+ l* _4 X3 p g& @Priority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
8 x1 f: x. W) mNode: 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)">: i9 r, |" F$ Y) ^7 `
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)">: b$ [3 ]1 V5 K4 [
Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp' d: ]2 t9 g, o7 r7 ` h2 E+ f6 B
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">
6 `: \) b4 @- ^" B6 o+ bStatus: Running
1 ?; I! a8 A+ T6 `7 k% a+ ?' vIP: </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)">
9 }- `" E* g7 d+ p0 JIPs:
* ]$ y X W: A 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( O7 U c h) m, }7 L& n/ FContainers:8 N" m9 T1 {' }. v4 l/ P& t
webapp:
2 y. W& f% ?/ c Q% [) n( ?7 ^ Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>
# L0 s9 Q* r; K) o' P 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)">
2 F/ V4 o- @, F! O; @% L8 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>- h9 R; k& q- K
Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
1 ^+ \7 @2 q2 c% }0 ? Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP+ K0 ~/ t, q( ?' I4 j0 V* C
State: Running1 l! A5 @. p( T" m; b' y% @9 z x0 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)">' O6 s! B# X, }: \7 _
Ready: True) D8 h p; ^. G! |. R5 o5 U
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">- ]1 j1 i0 P, R1 ^2 c4 G
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
+ @$ i% z y5 p+ @ Mounts:, f( M: q( @) L# I5 l5 Y
</span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
" h" i. r% Y S/ o- R: J </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro). Q( x+ s+ u& S
busybox:! w/ H+ O/ c) v; S8 `9 _ J5 o u3 d
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>1 ^' L- t/ F7 l2 }# {
<span style="color: rgba(0, 0, 0, 1)"> Image: busybox# D! x+ S& S. Y. v
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>
% \3 h( T- S) L Port: <none><span style="color: rgba(0, 0, 0, 1)">
, q0 L) _- L; s# _ Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">7 t) {0 }% N6 [* ^
Command:
- r d3 v4 l' `4 j </span><span style="color: rgba(0, 0, 255, 1)">sh</span>6 @6 Q: k0 G* L0 e4 S: j1 w' ^
-<span style="color: rgba(0, 0, 0, 1)">c/ g$ C" b# i& g* {
</span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out
; D# \1 b/ Y* Q Y; K' k6 D; \/ j State: Running
; x H, z V! w2 a 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)">
1 n+ U, ^* l8 H" O$ g& B. y Ready: True2 k) q2 T& r4 T |# r
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">2 J6 C4 u5 d9 F9 C8 b4 L8 b
Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
0 U& m; d1 |9 \' Y. V. i; i Mounts:4 \5 ^$ F) A& L
</span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)5 K% c4 q# P$ Q! X+ K
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)2 p" a/ Y* t1 e$ {; }
Conditions:
$ r/ u/ _4 V# K; j) D* N2 ~ Type Status
! e0 T& T: z) a- j/ ^ Initialized True
* _; {5 s: S. B Ready True
# m/ R' e2 {0 ]' X* | ContainersReady True+ G: q4 v4 B6 o% i& |2 k7 k
PodScheduled True0 ^! E6 H* f6 A* m/ ^7 P
Volumes:1 q# J( ~1 J5 [- D0 T
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:
2 F4 i% `9 ?9 [6 n/ |! S Type: EmptyDir (a temporary directory that shares a pod</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">s lifetime)</span>
) |2 t' C; X0 @& ?2 [<span style="color: rgba(0, 0, 0, 1)"> Medium:1 C( n- L/ k% q0 L1 H, c
SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
3 C) Z+ f( x4 r# o$ Y" I default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:
7 Y8 P4 }" ?8 n4 R Type: Secret (a volume populated by a Secret)
& U$ O" U$ w, C+ W SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h- S9 Q7 m; |) C4 t6 G$ J( o
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">5 l: g$ ]$ R8 v9 Q: _% S$ \7 K, C: r4 |
QoS Class: BestEffort! g I; A. k8 f" n4 _! i
Node</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">% k9 _- g% o8 d
Tolerations: node.kubernetes.io</span>/not-ready:NoExecute op=Exists <span style="color: rgba(0, 0, 255, 1)">for</span><span style="color: rgba(0, 0, 0, 1)"> 300s
) d' [6 D4 h- { 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
6 r3 x4 q( w# k/ `% u3 V# L* zEvents:% k5 r) Q1 v! i
Type Reason Age From Message9 f5 A9 m8 q8 _8 b- q4 l v1 V; e
</span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
2 _( L; l: P( M" _, V ~+ s+ e4 W Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato
L$ [' d7 k# e1 O A# A 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 D! E; R' R8 b2 Q; w% H
Normal Created 2m21s kubelet Created container webapp
' L4 g: Z" k" h Normal Started 2m21s kubelet Started container webapp
8 I' w2 G- ?. }2 ^/ c 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)">/ o# `+ ~ j7 c; p8 W1 s- D
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)">.633078305s6 m, ^( [. X. {( k1 }
Normal Created 15s kubelet Created container busybox
4 p4 ?0 S4 x" z# D; N0 C" _ Normal Started 14s kubelet Started container busybox</span></pre>) ^9 A* i+ d- U; P; K
</div>
! W0 C. {8 N Y' b% e2 E9 D; Y<p>真的是飞一般的感觉!!!</p>
+ `. h5 A6 V; }, E<p> </p>
# A( {3 H: b0 |<p>三、Context和Namespace切换</p>
0 p) M+ m! e# L" O1 \7 |) n<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>
9 W( ?+ B9 [3 }<p>kubectx安装</p>
, o/ r J: r+ P3 H<div class="cnblogs_code">" A& r6 e# p( ~2 [3 f9 q- 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>/ j0 W' k. S+ e f+ O$ l) q* V( }
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 Z5 T' f& @: J" ~8 Mremote: 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)">.8 V# g$ |! S% i" {8 z# X
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)">.
4 g( J) e2 U( h4 h: Sremote: 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)">.; w5 z% `' W7 w5 V
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)">; Z/ ~: |% ~$ w8 z+ ^( h9 c
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)">.& s: `+ I5 X+ }, m+ O
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)">.( }) w! ]" b: _, x
$ </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
# V% M. T: b0 Z6 x+ T$ z* M$ </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>5 l: g# v3 G) @3 o7 K. e
</div>
: v3 E: V6 k. ~<p>我们来看一下效果:</p>7 T6 k( P3 O8 @& F" y& ^8 R" W1 c
<div class="cnblogs_code">
9 _& f2 R: n6 T$ x: J8 U<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx
; d* o5 ^$ x6 R) w2 Dminikube% s: d$ |# r6 s u1 f9 |
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube! n1 w( {9 A8 O' u1 F
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)">., @; Z9 H6 s' i) ~5 p
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns
' N+ I, Y' x9 m8 Zdefault/ } b6 b6 @; N0 J, s+ ~9 U
kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease
5 D1 j0 \$ y; e- _6 dkube</span>-<span style="color: rgba(0, 0, 0, 1)">public) C1 y6 R% c0 i% t: y
kube</span>-<span style="color: rgba(0, 0, 0, 1)">system
1 S0 o, o5 ?* K, E$ _kubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
! X3 e9 C/ K. R+ ^$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public
. o H7 k2 j* n6 Y* p1 VContext </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.: F6 e8 ?4 o# [$ }; @# U/ h
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)">.( f! I; b! H, `' F* E$ h% h
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default. i8 b8 d5 F. a8 z+ v
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.
9 ^0 \# ?; S7 RActive 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>
; q4 S8 J. t. @# S</div>' v! y! s6 h/ O1 Y8 Q4 P- p
<p> </p>
/ e/ \5 d$ {# [0 a6 L$ R<p>四、跟踪查看多个Pod的日志</p>
% e- O, [/ y) F2 `: q<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
) C) B. B; ?# X2 B) W3 Y' B<ul class="list-paddingleft-2">
7 Y7 w" x" G' \: h# p! w6 e* z& _<li>% ]( g/ T" p' {1 r! U$ x
<p>允许使用正则表达式来选择需要查看的PodName</p>) B- u) `9 X' w* u' t' q
</li>& t. j7 `9 I- s. w; a
<li>
% ^2 N7 u5 a5 B/ X& j<p>为不同 Pod 的日志展示不同的颜色</p>
* m; G; k+ T Z' k% s' |6 g</li>) ^6 d% x" w9 V. ~/ N
<li>+ a4 i* @; b9 f
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>
|9 d8 |/ r, t H. ?</li>/ z! g" g( ]2 h9 ?3 e
</ul>
4 Q |: W3 T& i- X4 f9 _* q; K<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>
; ~- k9 [# b7 N<div class="cnblogs_code">
, U6 ~: H6 a% U7 d( K<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>" I: H2 c/ j1 I
<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>6 x3 E9 L# \" t5 T4 k
<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>
. }* _& S$ e4 o/ w& Y</div>6 r% L+ z9 T9 r: h( x
<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>
3 i/ M4 X. F9 M6 G<div class="cnblogs_code">, ^, x5 q# h0 B( a8 A2 ~" w5 i
<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)"> .5 Q! q5 X* d4 }( S$ k# U5 x3 b
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox
{+ W, U _; ]% T</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp
* `3 ?! j8 y& ^. _1 \' @) i' Q4 Ywebapp 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)">]
# u2 Z4 c" q! g8 B: x# S2 _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]3 s G+ r/ j0 A. x: z8 s
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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)">]. O& ?2 f1 o. {$ e* c( ~
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext
! B8 p, v) x" _% 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.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
' H( H3 V0 |7 x( `/ ]8 m W5 x }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)">
7 J- ?4 \6 p& f- ^5 V/ ywebapp 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)
; l& J8 O" j/ m$ `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)">]
% R/ ]/ t' Q- dwebapp 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)">
7 J' O% j5 E6 u* v2 M% 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.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)">)% C3 e5 |, q; [. ]$ ]/ {$ i
webapp webapp! K* G: \5 S7 i* |! {! X
webapp webapp . ____ _ __ _ _
1 ~9 a: W( Q8 L5 S, n0 C5 [" jwebapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>
, N' [9 x! E% R6 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>8 m, A6 c/ }2 Q" l
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )% j, n+ Z! G5 b6 E
webapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>! K- J3 l4 f8 T2 z3 L" F) g# @# I2 [
webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
k4 ]& L' }; V8 awebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)& _) I, x2 ^( D0 C9 T% g1 [* l
webapp webapp6 d3 `3 m8 \- q
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): w: F7 y+ ?2 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)">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. @5 p8 h* @! O; A" G" f2 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)">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)
4 Y/ X6 K7 O, X* e: a: W& y6 K 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.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)">]
* q5 a8 x7 [/ v; wwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
/ M+ i- E# c* 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.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)">]
4 R! F! @# S; C+ e+ c9 owebapp 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
- r9 _2 D5 `7 m: h8 ]9 C# {* 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.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
; o, v/ A5 Z& s! \' Rwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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 K8 J- E) z$ R3 ~. D) Fwebapp 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). l1 H( g+ u) }& z: r
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)">]# O; e4 ?" q8 z/ J
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)">: t# S9 N. V+ O* n0 g" j% Z3 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.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>* i8 R! J, r7 T2 M
</div>1 ]2 `! P7 w1 s: y+ ?
<p> </p>) V* h- p2 L: G1 o/ S8 T( Q
|
|