Skip to content

Commit fe4db40

Browse files
author
Andrew Reed
committed
Move host preflights examples into separate directory
Add all supported analyzers to host preflight sample. Don't log transient errors waiting for TCP connection. Begin human stdout results on new line after spinner.
1 parent 5eef177 commit fe4db40

File tree

16 files changed

+192
-53
lines changed

16 files changed

+192
-53
lines changed

cmd/preflight/cli/stdout_results.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func showStdoutResults(format string, preflightName string, analyzeResults []*an
1919
}
2020

2121
func showStdoutResultsHuman(preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) error {
22+
fmt.Println("")
2223
var failed bool
2324
for _, analyzeResult := range analyzeResults {
2425
testResultfailed := outputResult(analyzeResult)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
apiVersion: troubleshoot.sh/v1beta2
2+
kind: HostPreflight
3+
metadata:
4+
name: example
5+
spec:
6+
collectors:
7+
- blockDevices: {}
8+
- cpu: {}
9+
- diskUsage:
10+
collectorName: ephemeral
11+
path: /var/lib/kubelet
12+
- httpLoadBalancer:
13+
collectorName: httploadbalancer
14+
port: 80
15+
address: http://app.corporate.internal
16+
timeout: 10s
17+
- http:
18+
collectorName: registry
19+
get:
20+
url: https://registry.replicated.com
21+
- ipv4Interfaces: {}
22+
- memory: {}
23+
- time: {}
24+
- tcpConnect:
25+
collectorName: weave host 1
26+
address: 10.128.0.2:6783
27+
timeout: 2s
28+
- tcpLoadBalancer:
29+
collectorName: LB1
30+
address: 10.128.0.20:6443
31+
port: 6443
32+
timeout: 5000ms
33+
- tcpPortStatus:
34+
collectorName: k8s
35+
port: 6443
36+
analyzers:
37+
- blockDevices:
38+
outcomes:
39+
- pass:
40+
when: ".* == 1"
41+
message: One available block device
42+
- pass:
43+
when: ".* > 1"
44+
message: Multiple available block devices
45+
- fail:
46+
message: No available block devices
47+
- cpu:
48+
outcomes:
49+
- fail:
50+
when: "< 4"
51+
message: This server has less than 4 CPU cores, and we require 8, but recommend 16
52+
- warn:
53+
when: "< 16"
54+
message: This server has at least 4 CPU cores, but we recommend 16 or more
55+
- pass:
56+
message: This server has sufficient CPU cores
57+
- diskUsage:
58+
collectorName: ephemeral
59+
outcomes:
60+
- fail:
61+
when: "total < 20Gi"
62+
message: /var/lib/kubelet has less than 20Gi of total space
63+
- fail:
64+
when: "available < 10Gi"
65+
message: /var/lib/kubelet has less than 10Gi of disk space available
66+
- fail:
67+
when: "used/total > 70%"
68+
message: /var/lib/kubelet is more than 70% full
69+
- pass:
70+
message: /var/lib/kubelet has sufficient disk space available
71+
- httpLoadBalancer:
72+
collectorName: httploadbalancer
73+
outcomes:
74+
- fail:
75+
when: "connection-refused"
76+
message: Connection to port 80 via load balancer was refused.
77+
- fail:
78+
when: "address-in-use"
79+
message: Another process was already listening on port 80.
80+
- fail:
81+
when: "connection-timeout"
82+
message: Timed out connecting to port 80 via load balancer. Check your firewall.
83+
- fail:
84+
when: "bind-permission-denied"
85+
message: Bind permission denied. Try running as root.
86+
- fail:
87+
when: "error"
88+
message: Failed to connect to port 80 via load balancer.
89+
- pass:
90+
when: "connected"
91+
message: Successfully connected to port 80 via load balancer.
92+
- http:
93+
collectorName: registry
94+
outcomes:
95+
- fail:
96+
when: "error"
97+
message: Error connecting to registry
98+
- pass:
99+
when: "statusCode == 404"
100+
message: Connected to registry
101+
- fail:
102+
message: "Unexpected response"
103+
- ipv4Interfaces:
104+
outcomes:
105+
- fail:
106+
when: "count == 0"
107+
message: No IPv4 interfaces detected
108+
- warn:
109+
when: "count >= 2"
110+
message: Multiple IPv4 interfaces detected
111+
- pass:
112+
when: "count == 1"
113+
message: IPv4 interface detected
114+
- memory:
115+
outcomes:
116+
- fail:
117+
when: "< 8Gi"
118+
message: At least 8Gi of memory is required
119+
- warn:
120+
when: "< 32Gi"
121+
message: At least 32Gi of memory is recommended
122+
- pass:
123+
message: The system has as sufficient memory
124+
- time:
125+
outcomes:
126+
- fail:
127+
when: "ntp == unsynchronized+inactive"
128+
message: System clock not synchronized
129+
- warn:
130+
when: "ntp == unsynchronized+active"
131+
message: System clock not yet synchronized
132+
- warn:
133+
when: "ntp == synchronized+inactive"
134+
message: NTP not active
135+
- pass:
136+
when: "ntp == synchronized+active"
137+
message: System clock is synchronized
138+
- tcpConnect:
139+
collectorName: weave host 1
140+
outcomes:
141+
- fail:
142+
when: "connection-refused"
143+
message: Connection to weave on host 1 was refused
144+
- fail:
145+
when: "connection-timeout"
146+
message: Timed out connecting to weave on host 1
147+
- fail:
148+
when: "error"
149+
message: Unexpected error connecting to weave on host 1
150+
- pass:
151+
when: "connected"
152+
message: Successfully connected to weave on host 1
153+
- tcpLoadBalancer:
154+
collectorName: LB1
155+
outcomes:
156+
- fail:
157+
when: "connection-timeout"
158+
message: The TCP Load Balancer is not forwarding traffic to this server.
159+
- fail:
160+
when: "address-in-use"
161+
message: The local port is not available to validate the Load Balancer configuration.
162+
- pass:
163+
when: "connected"
164+
message: The specified TCP Load Balancer appears to be properly forwarding traffic to this server.
165+
- tcpPortStatus:
166+
collectorName: k8s
167+
outcomes:
168+
- fail:
169+
when: "connection-refused"
170+
message: Connection to port 7443 was refused.
171+
- fail:
172+
when: "address-in-use"
173+
message: Another process was already listening on port 7443.
174+
- fail:
175+
when: "connection-timeout"
176+
message: Timed out connecting to port 7443. Check your firewall.
177+
- fail:
178+
when: "error"
179+
message: Unexpected port status
180+
- pass:
181+
when: "connected"
182+
message: Port 7443 is open
183+
- warn:
184+
message: Unexpected port status
185+
- time:
186+
outcomes:
187+
- pass:
188+
when: "timezone == UTC"
189+
message: Timezone is UTC
190+
- fail:
191+
message: Timezone is not UTC

0 commit comments

Comments
 (0)