|
7 L u6 S3 I Y$ }# w! q k+ x
<p>kubectl作为我们主要的操作K8S的工具,其具备非常丰富的功能,但是如果不经过打磨,使用起来还是存在诸多不便,今天我们来看看如何将我们的kubectl打磨的更加易用。</p>
) j( V, w* A3 D( S<p> </p>
0 t% {$ {, U6 ]9 u7 b6 k<p>一、命令自动补全</p>8 t) e" ?' S; ~7 w' Z
<p>kubectl中提供非常多的命令,如果每一次都要手动一个字符一个字符的敲未免太累了,那么如何配置自动补全呢?这里以ubuntu系统为例:</p>2 C" Z- t7 Q4 Z0 L: H1 n7 |
<p>1、安装auto-completion工具</p>
5 C% m t" ~4 m% g9 U3 f<div class="cnblogs_code">2 Y) L/ B2 @4 o5 T" a4 N' M: |- V
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> apt update8 w1 Q6 M; @' J2 A5 p& b
Hit:</span><span style="color: rgba(128, 0, 128, 1)">1</span> http:<span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">archive.ubuntu.com/ubuntu bionic InRelease</span>" m, C; L0 o* H5 V# ^6 o
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>1 T7 Y+ k8 R3 o/ X
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>* i$ _3 b. e7 [1 w4 A! q
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>
: b R% C) n+ A" 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>
+ ?6 |. }8 O) H; ~6 n<span style="color: rgba(0, 0, 0, 1)">Reading package lists... Done1 M! i) \9 l0 e; q2 O! V
Building dependency tree0 m/ |# W n& V6 A
Reading state information... Done
) ?3 O4 {' K0 ^ q# ^+ {3 U</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.
% {. G9 ]6 {1 K- [9 K$ </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)">completion1 D: ]" D2 A2 H6 ?) r, i
Reading package lists... Done
1 m* {; t, K4 `: m- Z. a4 {Building dependency tree. J" H6 ^; @' P9 p: `, f
Reading state information... Done0 R9 R+ I1 J0 L9 t2 b
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).6 f+ q* p v6 n7 U5 U
</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>" [+ ~3 i' x4 F2 f' D/ V" u
</div>
; r- o$ m" Y8 |) }% z& o" O<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>
4 U: K; L8 Y$ f7 L) o<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>
* k7 n1 `) K4 D$ j9 Q<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>+ X" L4 v; X, R1 z) D9 q! y
<div class="cnblogs_code">
& A; e! l% c/ T, V<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion bash)
5 W# b5 _; L" u8 W/ Y- M9 `</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 b/ K* J. x6 C' x* ?0 @</div>! q! Q* |6 t7 s- s% X/ `. ?" h. i. }& d
<p><strong>Zsh</strong>:</p>
5 z: B E5 }9 s" q/ g- `( ]<div class="cnblogs_code">- e( s: V$ |4 f: P
<pre>source <<span style="color: rgba(0, 0, 0, 1)">(kubectl completion zsh)5 \1 d4 e3 Z$ n/ V+ l( B! _/ 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>- L& N2 J" s% S6 C) {1 j
</div>/ Z3 \4 n& f( ?6 m
<p>配置后就可以通过Tab键自动补全命令啦!</p>& s8 }4 ^! g, E* L
<p> </p>
4 b; B3 F7 d1 A2 c+ g<p>二、配置kubectl别名</p>
! D2 w! n3 W! @8 D5 z<p>我们可以通过设置别名简化kubectl命令,编辑.bashrc文件,添加如下内容:</p>
' n2 B$ |0 N$ j4 |8 |<div class="cnblogs_code">
) g: m- R5 L, c9 @2 R L( z* F- k<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)">* O. A R: |" p- S
alias k</span>=<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">kubectl</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">0 }: t* C" Z: Q8 b' N1 ]8 s; g
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)">
# t1 x6 H9 [4 z1 |* h3 }% Q ?- Zalias 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)">
+ p- p/ A, a' Salias 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)">
8 e; ^+ G% t X2 M9 ~& j' ^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)"># s0 {6 M% r9 W: ^$ o
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>
/ K2 Q6 S( T- Y7 Y% _</div>
# n; X7 \# {* y# g6 `+ _- ]: ~<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>6 c, k$ |. `7 I. R8 C
<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>+ B1 b3 r, e" j
<div class="cnblogs_code">
: {( E0 f" i, L/ F+ k E<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> ka webapp_pod.yaml( n* D4 y) c& b5 c* _% m: f
pod</span>/<span style="color: rgba(0, 0, 0, 1)">webapp created
2 S9 P: y: w8 e$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kg pods
& T2 W+ j+ v4 Y2 @4 l3 rNAME READY STATUS RESTARTS AGE' t$ Q; p' h8 F4 i; d! |5 X5 ~
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
, p3 I1 x8 Q* x c# _$ D) W2 n$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> kd pod webapp
5 V# [2 [" {$ _Name: webapp
0 l& l/ O% X3 z, v/ fNamespace: default
0 O! Z' u$ [) A/ C$ P6 K! iPriority: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">) A7 O7 P0 R2 s' |
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)">4 w7 U7 x) v$ H" J$ x; L
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)">
" g, ^5 w0 [% X( \8 J) S7 w/ ^Labels: app</span>=<span style="color: rgba(0, 0, 0, 1)">webapp; \0 V/ I" S L5 O; ~5 w( ]8 y
Annotations: </span><none><span style="color: rgba(0, 0, 0, 1)">$ M9 t) | D% A q0 v
Status: Running' w" v$ O3 T# I Z' Z F
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 k/ g- ~3 W! W+ W" _0 ^
IPs: l7 w: d. q, P7 n
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)">
2 q: L' @/ x! \! u9 A* H4 x# QContainers:
& [* v/ e! f5 b5 d/ W webapp:+ v0 o% v) }1 N6 e
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">d9ddf9dd47de12b53f2119bf75df6706bee2e7711509638ad52adc9addeda704</span>4 w. C( H6 j, I ?' i: `$ Q
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)">, b$ O4 S0 Y7 h 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>
6 c- N) B/ c a$ \3 E1 a2 B1 v Port: <span style="color: rgba(128, 0, 128, 1)">5000</span>/<span style="color: rgba(0, 0, 0, 1)">TCP' M# y3 }1 `7 e8 b# K
Host Port: </span><span style="color: rgba(128, 0, 128, 1)">0</span>/<span style="color: rgba(0, 0, 0, 1)">TCP
- v: w3 ?& G, u2 q q State: Running
! a8 y; r4 }* p" D: a8 f 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)">4 Q' V& U6 L0 _4 z& ]* ]0 z
Ready: True3 @1 M+ u2 d: z( i2 a
Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
4 n" m' _/ [4 J" E Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
- E$ R8 u/ J: R- w$ E: E. z Mounts:
! K8 E& d: s8 M5 w </span>/tmp from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)
% b1 F0 h! D# H: L% ? </span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
& g; u$ m, T4 {, B* q busybox:- I3 B: M5 y0 H7 {! q$ O
Container ID: docker:</span><span style="color: rgba(0, 128, 0, 1)">//</span><span style="color: rgba(0, 128, 0, 1)">6a6a35a628a782fc643af3dd49986bbc77c23de1ae4726bc521c77f61abbbf5d</span>7 \3 q. S/ n, j& R$ b" `
<span style="color: rgba(0, 0, 0, 1)"> Image: busybox
& R8 v$ [3 h$ W7 w' X) v9 u 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>% @/ E+ d+ X( K6 u
Port: <none><span style="color: rgba(0, 0, 0, 1)">* w- T' S/ l, o D2 a2 P9 Z7 W
Host Port: </span><none><span style="color: rgba(0, 0, 0, 1)">' i! w; D/ K% g6 [, U
Command:
% M/ T8 y" ]6 G6 U </span><span style="color: rgba(0, 0, 255, 1)">sh</span>
( _: o) O6 g7 `& d& ~! L" J2 t -<span style="color: rgba(0, 0, 0, 1)">c
, j- H5 K. W* W) e+ X) ? </span><span style="color: rgba(0, 0, 255, 1)">tail</span> -f /logs/<span style="color: rgba(0, 0, 0, 1)">log.out3 i! b- O0 V2 x9 ^# N0 l4 X8 { z
State: Running
& M/ D S; U! P& O 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 |( k$ n; g, ]6 F2 c" J+ y
Ready: True
1 J% D; Z# ?9 C! p. o5 n Restart Count: </span><span style="color: rgba(128, 0, 128, 1)">0</span><span style="color: rgba(0, 0, 0, 1)">
1 [( x6 h1 r7 B9 {3 s Environment: </span><none><span style="color: rgba(0, 0, 0, 1)">
1 i$ D+ x- s7 s4 f3 q Mounts:
) ` `( ~- u8 m) S: [ </span>/logs from webapp-<span style="color: rgba(0, 0, 0, 1)">logs (rw)9 N7 I& `+ k8 B* u' r+ r- i' t
</span>/var/run/secrets/kubernetes.io/serviceaccount from default-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h (ro)
( Z5 k0 ?; ^' b9 H& | Z! F; J- XConditions:- u8 Y) R4 g" h7 F+ m
Type Status
$ u" r2 X% I" x! [# p( k* [ Initialized True+ p- }5 M9 ?3 Y/ E0 [9 F! n( W
Ready True
: R- V+ P9 G$ w1 m- z9 r6 P ContainersReady True0 |9 j+ V0 R1 c5 c9 x
PodScheduled True1 r- L1 R+ s$ T% R5 @! p
Volumes:2 d; Y' P2 @# ~# z
webapp</span>-<span style="color: rgba(0, 0, 0, 1)">logs:
- |) U4 G( w( t2 T+ \& 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>
( L: d& T# ~7 n; t& @<span style="color: rgba(0, 0, 0, 1)"> Medium:
* _3 D( n9 P) A, `9 f' G7 Z SizeLimit: </span><unset><span style="color: rgba(0, 0, 0, 1)">
2 d% k7 P5 h( y3 W default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h:* d6 u6 Y" M" A6 G8 b& a
Type: Secret (a volume populated by a Secret)
7 Y3 w% x- R8 b SecretName: default</span>-token-<span style="color: rgba(0, 0, 0, 1)">pcr2h! ^, L0 s! c4 q: n- `' Z3 A
Optional: </span><span style="color: rgba(0, 0, 255, 1)">false</span><span style="color: rgba(0, 0, 0, 1)">
/ n" g0 X9 j( ^7 |7 M* ~/ bQoS Class: BestEffort
/ r& D& ~/ s9 ~" yNode</span>-Selectors: <none><span style="color: rgba(0, 0, 0, 1)">% p( w$ x$ n% l4 s: H( U
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)"> 300s0 M& h2 D6 I# F" }
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) `) r& v u. g* d( \- t+ ^
Events:0 u( d7 r5 W$ c7 d, R& i* \
Type Reason Age From Message( O" o( Y( |" a& b" O
</span>---- ------ ---- ---- -------<span style="color: rgba(0, 0, 0, 1)">
( C% c7 m1 X0 ]& `" W' Z Normal Scheduled 2m23s default</span>-scheduler Successfully assigned default/<span style="color: rgba(0, 0, 0, 1)">webapp to ayato7 Y- M' b" \2 s- D
Normal Pulled 2m22s kubelet Container image </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">172.16.194.135:5000/webapp:1.0</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)"> already present on machine
6 a5 y4 S) n; n) W8 ?( p Normal Created 2m21s kubelet Created container webapp7 x9 G$ q. e& \9 P3 w( a
Normal Started 2m21s kubelet Started container webapp( {! ^! Y' U; Q. o# |& Q
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)">, N2 K& C2 u# v% f( g" ~
Normal Pulled 15s kubelet Successfully pulled image </span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">busybox</span><span style="color: rgba(128, 0, 0, 1)">"</span> <span style="color: rgba(0, 0, 255, 1)">in</span> <span style="color: rgba(128, 0, 128, 1)">14</span><span style="color: rgba(0, 0, 0, 1)">.633078305s/ E9 q$ f. A- ^, h7 v, k' B' y) G
Normal Created 15s kubelet Created container busybox
7 e b ]# h2 v2 p7 ~# z1 b$ g% d Normal Started 14s kubelet Started container busybox</span></pre>
4 l# M/ r3 f! W</div>
$ q4 K T6 I: p' N8 t& a<p>真的是飞一般的感觉!!!</p>
$ i6 z! P9 F7 {<p> </p>
) H+ _' T9 t! s! q<p>三、Context和Namespace切换</p>
* G" ~9 g r# M, C0 n<p>我们在公司的容器平台上使用kubectl时,经常需要切换context和namespace,导致命令非常繁琐,那有没有简便的方式呢?—— kubectx</p>. }1 H# \3 t& F
<p>kubectx安装</p>) `# Q. }% Y' G+ f! `1 z
<div class="cnblogs_code">; f/ K8 M% L; E
<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>/ ]8 o! U( O: L/ t- I
Cloning into <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">/opt/kubectx</span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(0, 0, 0, 1)">...
8 j2 j O* j% L- f& W- [# ~remote: Enumerating objects: </span><span style="color: rgba(128, 0, 128, 1)">1457</span>, <span style="color: rgba(0, 0, 255, 1)">done</span><span style="color: rgba(0, 0, 0, 1)">.* k; e h: u: B6 f* q4 e w
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)">./ U/ _, d# z. @4 Y# B& 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)">.# \( B1 H" q Y- H+ m1 F
remote: Total </span><span style="color: rgba(128, 0, 128, 1)">1457</span> (delta <span style="color: rgba(128, 0, 128, 1)">85</span>), reused <span style="color: rgba(128, 0, 128, 1)">97</span> (delta <span style="color: rgba(128, 0, 128, 1)">51</span>), pack-reused <span style="color: rgba(128, 0, 128, 1)">1285</span><span style="color: rgba(0, 0, 0, 1)">$ p4 J! T& v# r
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)">.: c) f/ F3 v2 Q8 r
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)">.
2 [+ X8 O9 Z9 l$ </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
! O" `( A8 | b2 e- C8 G, B& U$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> <span style="color: rgba(0, 0, 255, 1)">ln</span> -s /opt/kubectx/kubectx /usr/local/bin/kubectl-ctx</pre>+ }* ^9 n9 P, P
</div>
% d2 f8 ?2 ~$ D' K( m! U- `# J4 w<p>我们来看一下效果:</p> |- c* ~ P/ i( J* q$ N8 |4 w8 x
<div class="cnblogs_code">% e; S; u" Q0 ^
<pre>$ <span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx9 @8 I; j# r+ k: L* K# C7 C; w
minikube( c6 }* | {% l% \ I
$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ctx minikube
6 h' \$ F. a, u. X8 p5 ]4 V1 }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)">.
, q: E S4 ^+ I& _9 G$ H% H$ C$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns) \- M+ M6 ]; x# Y' b
default
% R3 s( a+ [% ]( ~2 h7 q$ `! `kube</span>-node-<span style="color: rgba(0, 0, 0, 1)">lease
. f8 T" _: B2 ^9 [ u) |; i" ukube</span>-<span style="color: rgba(0, 0, 0, 1)">public
* T! C- |4 @/ U8 nkube</span>-<span style="color: rgba(0, 0, 0, 1)">system
* [+ C: j$ {: Jkubernetes</span>-<span style="color: rgba(0, 0, 0, 1)">dashboard
9 E% o. Q1 b. I6 }# y: Q4 W6 R$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span> k ns kube-<span style="color: rgba(0, 0, 0, 1)">public, \! t4 t& |, A7 u3 `2 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.
r- \* l' u* H2 I2 EActive 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)">.
) A9 @2 L. Z6 i: q$ </span><span style="color: rgba(0, 0, 255, 1)">sudo</span><span style="color: rgba(0, 0, 0, 1)"> k ns default9 D& e0 {8 L+ E* A0 W# m
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.) z( ?; v6 d! W9 A7 Z7 w) A/ {
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>1 ?. g! Z: _2 C. f: p
</div>
5 R7 E2 @: V7 P6 e<p> </p>
0 ]. o- C3 \2 [' i: T$ H<p>四、跟踪查看多个Pod的日志</p>9 h% S& g' f' |# ]4 {
<p>我们一般使用kubectl logs命令查看Pod日志,但是它不能通过-f参数同时跟踪查看多个Pod日志,这就不方便了,毕竟实际生产环境中每个服务都会有多个Pod,这时我们可以使用stern这个工具,它具备如下能力:</p>
" F' ]7 w0 s' ?# x+ ~8 V<ul class="list-paddingleft-2">: y4 C7 L) w. V F/ F( z0 z3 n
<li>
# m6 y6 U3 r+ v# r. N& o<p>允许使用正则表达式来选择需要查看的PodName</p>
: R6 S; K( O1 d8 m$ n; l/ k</li>. i* N7 K x. {1 H" Z8 ?" d! X
<li>; \1 Q I% W8 r6 o/ R
<p>为不同 Pod 的日志展示不同的颜色</p>
: b9 o* ]% t" o# q c8 h2 c</li>
6 e1 R+ T+ ~3 t& L" d W<li>: }, | n6 U: d6 f+ H9 b; q
<p>跟踪日志过程中假如有符合规则的新 Pod 被创建, 那么会自动添加到输出中</p>
! V; \. ~$ R% D. j! s0 M</li>: {- K; K% H7 g" A+ B5 y( o
</ul>
6 i/ h% `- m+ Q/ G$ k5 f% o8 D, D<p>首先安装stern(下载stern时可能较慢可以多试几次):</p>5 ~" ^! D0 K' a+ P, I
<div class="cnblogs_code"> U# @/ ^7 P Y1 `$ 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>. L( m0 y- G$ u! q& g# z8 v) V
<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>
) I( b+ \: }* v' K. A3 z; c( H8 D<span style="color: rgba(0, 0, 255, 1)">sudo</span> chomd +x /usr/local/bin/kubectl-<span style="color: rgba(0, 0, 255, 1)">tail</span></pre>3 U8 T+ V* u. D. Q. k
</div>3 a4 X( ^# q' M6 e1 l! Z
<p>安装完毕后让我一起感受一下stern的魅力吧,我的Pod里面有两个容器:webapp和busybox,如果使用kubectl logs 还得指定具体的容器,而使用stern就没有这样的限制。</p>5 W+ a0 g( Y; Y2 l: v
<div class="cnblogs_code">9 o9 i2 C5 }. R5 w( A, }8 ?# y
<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)"> .
1 Z/ [1 r5 ]+ ?8 U( {. n: X</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › busybox; Y0 W# y' w* @1 c5 P
</span>+<span style="color: rgba(0, 0, 0, 1)"> webapp › webapp
$ ^7 s$ o0 P/ q' x/ X3 nwebapp 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)">]
. N3 g, {$ N$ m! J9 m" e' p0 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.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
1 ]/ p( u, M# g% K5 ^: }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)">]
9 o$ n4 F: A7 q' H) T- 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)">53.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext H0 I8 @+ O. T; u
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.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# x7 v: Y F& s' a7 S/ ^+ o0 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)">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)">) j& u4 `. V) B" U1 R
webapp busybox </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.264</span> [WARN ] [main] [org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration] Cannot <span style="color: rgba(0, 0, 255, 1)">find</span> template location: classpath:/templates/<span style="color: rgba(0, 0, 0, 1)"> (please add some templates or check your Thymeleaf configuration)) w3 L' d+ S9 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)">]
. N" ^1 s% y! f( 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.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)">4 F" ^- d- Q$ O: P3 @
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)">)0 z7 P2 B. B# P% K% t' A8 m
webapp webapp
/ U8 Z! a u# Kwebapp webapp . ____ _ __ _ _9 x2 s, W7 N: K8 e) `, y. U+ b9 r2 ~
webapp webapp </span>/\\ / ___<span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ __ _ _(_)_ __ __ _ \ \ \ \</span>2 {9 _6 v, A4 H4 B; j9 _
webapp webapp ( ( )\___ | <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ | </span><span style="color: rgba(128, 0, 0, 1)">'</span>_| | <span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)">_ \/ _` | \ \ \ \</span>. q4 a. f+ |2 k# y7 t8 |
webapp webapp \\/ ___)| |_)| | | | | || (_| |<span style="color: rgba(0, 0, 0, 1)"> ) ) ) )
5 F6 Q/ \+ f' E, g: ~+ y% {* fwebapp webapp </span><span style="color: rgba(128, 0, 0, 1)">'</span><span style="color: rgba(128, 0, 0, 1)"> |____| .__|_| |_|_| |_\__, | / / / /</span>
0 P: G& W# T4 ~webapp webapp =========|_|==============|___/=/_/_/_/<span style="color: rgba(0, 0, 0, 1)">
( C6 D8 H2 O- `9 t. a/ T9 ]' ywebapp webapp :: Spring Boot :: (v2.</span><span style="color: rgba(128, 0, 128, 1)">4.2</span><span style="color: rgba(0, 0, 0, 1)">)5 P" [' b3 H: g# y; a
webapp webapp
2 W$ s9 K& b( d/ Hwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">50.124</span> [INFO ] [main] [org.demo.webapp.todolist.TodoListApplication] Starting TodoListApplication v1.<span style="color: rgba(128, 0, 128, 1)">0</span>-SNAPSHOT using Java <span style="color: rgba(128, 0, 128, 1)">1.8</span>.0_111 on webapp with PID <span style="color: rgba(128, 0, 128, 1)">1</span> (/opt/soft/webapp.jar started by root <span style="color: rgba(0, 0, 255, 1)">in</span> /opt/<span style="color: rgba(0, 0, 0, 1)">soft)! Z/ \3 n6 a0 _. F @
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# e! H; u f" V: D: j8 v# l( S4 N
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)6 o2 Z9 U1 p! Z4 A2 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)">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)">]6 Z7 z) V# O9 W6 p* `, ^. 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)">53.200</span><span style="color: rgba(0, 0, 0, 1)"> [INFO ] [main] [org.apache.catalina.core.StandardService] Starting service [Tomcat]
) U q# S$ |/ y9 P+ E$ 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.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)">]! t( b U5 t1 R- K2 ]. A
webapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">53.324</span> [INFO ] [main] [org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/<span style="color: rgba(0, 0, 0, 1)">]] Initializing Spring embedded WebApplicationContext
2 e9 R4 O, H0 w" f6 X swebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">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& J* `3 o, g' 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)">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)">* u( _- M: [7 ~5 ^
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)
' K, @5 h, w: Qwebapp webapp </span><span style="color: rgba(128, 0, 128, 1)">14</span>:<span style="color: rgba(128, 0, 128, 1)">04</span>:<span style="color: rgba(128, 0, 128, 1)">54.377</span> [INFO ] [main] [org.apache.coyote.http11.Http11NioProtocol] Starting ProtocolHandler [<span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(128, 0, 0, 1)">http-nio-4567</span><span style="color: rgba(128, 0, 0, 1)">"</span><span style="color: rgba(0, 0, 0, 1)">]
6 U' Y! ~7 I! @3 P. I8 Ywebapp 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)">- x! E |9 w( `9 e, 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.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>9 X: e" n: L! `7 _0 k
</div>! W% b% e- E/ V& q2 a/ P
<p> </p>& k; D8 i6 X2 R, e; o
|
|