mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
Merge pull request #322 from areed/host-preflight-examples
Move host preflights examples into separate directory
This commit is contained in:
@@ -19,6 +19,7 @@ func showStdoutResults(format string, preflightName string, analyzeResults []*an
|
||||
}
|
||||
|
||||
func showStdoutResultsHuman(preflightName string, analyzeResults []*analyzerunner.AnalyzeResult) error {
|
||||
fmt.Println("")
|
||||
var failed bool
|
||||
for _, analyzeResult := range analyzeResults {
|
||||
testResultfailed := outputResult(analyzeResult)
|
||||
|
||||
191
examples/preflight/host/sample.yaml
Normal file
191
examples/preflight/host/sample.yaml
Normal file
@@ -0,0 +1,191 @@
|
||||
apiVersion: troubleshoot.sh/v1beta2
|
||||
kind: HostPreflight
|
||||
metadata:
|
||||
name: example
|
||||
spec:
|
||||
collectors:
|
||||
- blockDevices: {}
|
||||
- cpu: {}
|
||||
- diskUsage:
|
||||
collectorName: ephemeral
|
||||
path: /var/lib/kubelet
|
||||
- httpLoadBalancer:
|
||||
collectorName: httploadbalancer
|
||||
port: 80
|
||||
address: http://app.corporate.internal
|
||||
timeout: 10s
|
||||
- http:
|
||||
collectorName: registry
|
||||
get:
|
||||
url: https://registry.replicated.com
|
||||
- ipv4Interfaces: {}
|
||||
- memory: {}
|
||||
- time: {}
|
||||
- tcpConnect:
|
||||
collectorName: weave host 1
|
||||
address: 10.128.0.2:6783
|
||||
timeout: 2s
|
||||
- tcpLoadBalancer:
|
||||
collectorName: LB1
|
||||
address: 10.128.0.20:6443
|
||||
port: 6443
|
||||
timeout: 5000ms
|
||||
- tcpPortStatus:
|
||||
collectorName: k8s
|
||||
port: 6443
|
||||
analyzers:
|
||||
- blockDevices:
|
||||
outcomes:
|
||||
- pass:
|
||||
when: ".* == 1"
|
||||
message: One available block device
|
||||
- pass:
|
||||
when: ".* > 1"
|
||||
message: Multiple available block devices
|
||||
- fail:
|
||||
message: No available block devices
|
||||
- cpu:
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "< 4"
|
||||
message: This server has less than 4 CPU cores, and we require 8, but recommend 16
|
||||
- warn:
|
||||
when: "< 16"
|
||||
message: This server has at least 4 CPU cores, but we recommend 16 or more
|
||||
- pass:
|
||||
message: This server has sufficient CPU cores
|
||||
- diskUsage:
|
||||
collectorName: ephemeral
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "total < 20Gi"
|
||||
message: /var/lib/kubelet has less than 20Gi of total space
|
||||
- fail:
|
||||
when: "available < 10Gi"
|
||||
message: /var/lib/kubelet has less than 10Gi of disk space available
|
||||
- fail:
|
||||
when: "used/total > 70%"
|
||||
message: /var/lib/kubelet is more than 70% full
|
||||
- pass:
|
||||
message: /var/lib/kubelet has sufficient disk space available
|
||||
- httpLoadBalancer:
|
||||
collectorName: httploadbalancer
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "connection-refused"
|
||||
message: Connection to port 80 via load balancer was refused.
|
||||
- fail:
|
||||
when: "address-in-use"
|
||||
message: Another process was already listening on port 80.
|
||||
- fail:
|
||||
when: "connection-timeout"
|
||||
message: Timed out connecting to port 80 via load balancer. Check your firewall.
|
||||
- fail:
|
||||
when: "bind-permission-denied"
|
||||
message: Bind permission denied. Try running as root.
|
||||
- fail:
|
||||
when: "error"
|
||||
message: Failed to connect to port 80 via load balancer.
|
||||
- pass:
|
||||
when: "connected"
|
||||
message: Successfully connected to port 80 via load balancer.
|
||||
- http:
|
||||
collectorName: registry
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "error"
|
||||
message: Error connecting to registry
|
||||
- pass:
|
||||
when: "statusCode == 404"
|
||||
message: Connected to registry
|
||||
- fail:
|
||||
message: "Unexpected response"
|
||||
- ipv4Interfaces:
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "count == 0"
|
||||
message: No IPv4 interfaces detected
|
||||
- warn:
|
||||
when: "count >= 2"
|
||||
message: Multiple IPv4 interfaces detected
|
||||
- pass:
|
||||
when: "count == 1"
|
||||
message: IPv4 interface detected
|
||||
- memory:
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "< 8Gi"
|
||||
message: At least 8Gi of memory is required
|
||||
- warn:
|
||||
when: "< 32Gi"
|
||||
message: At least 32Gi of memory is recommended
|
||||
- pass:
|
||||
message: The system has as sufficient memory
|
||||
- time:
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "ntp == unsynchronized+inactive"
|
||||
message: System clock not synchronized
|
||||
- warn:
|
||||
when: "ntp == unsynchronized+active"
|
||||
message: System clock not yet synchronized
|
||||
- warn:
|
||||
when: "ntp == synchronized+inactive"
|
||||
message: NTP not active
|
||||
- pass:
|
||||
when: "ntp == synchronized+active"
|
||||
message: System clock is synchronized
|
||||
- tcpConnect:
|
||||
collectorName: weave host 1
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "connection-refused"
|
||||
message: Connection to weave on host 1 was refused
|
||||
- fail:
|
||||
when: "connection-timeout"
|
||||
message: Timed out connecting to weave on host 1
|
||||
- fail:
|
||||
when: "error"
|
||||
message: Unexpected error connecting to weave on host 1
|
||||
- pass:
|
||||
when: "connected"
|
||||
message: Successfully connected to weave on host 1
|
||||
- tcpLoadBalancer:
|
||||
collectorName: LB1
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "connection-timeout"
|
||||
message: The TCP Load Balancer is not forwarding traffic to this server.
|
||||
- fail:
|
||||
when: "address-in-use"
|
||||
message: The local port is not available to validate the Load Balancer configuration.
|
||||
- pass:
|
||||
when: "connected"
|
||||
message: The specified TCP Load Balancer appears to be properly forwarding traffic to this server.
|
||||
- tcpPortStatus:
|
||||
collectorName: k8s
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "connection-refused"
|
||||
message: Connection to port 7443 was refused.
|
||||
- fail:
|
||||
when: "address-in-use"
|
||||
message: Another process was already listening on port 7443.
|
||||
- fail:
|
||||
when: "connection-timeout"
|
||||
message: Timed out connecting to port 7443. Check your firewall.
|
||||
- fail:
|
||||
when: "error"
|
||||
message: Unexpected port status
|
||||
- pass:
|
||||
when: "connected"
|
||||
message: Port 7443 is open
|
||||
- warn:
|
||||
message: Unexpected port status
|
||||
- time:
|
||||
outcomes:
|
||||
- pass:
|
||||
when: "timezone == UTC"
|
||||
message: Timezone is UTC
|
||||
- fail:
|
||||
message: Timezone is not UTC
|
||||
@@ -1,51 +0,0 @@
|
||||
apiVersion: troubleshoot.sh/v1beta2
|
||||
kind: HostPreflight
|
||||
metadata:
|
||||
name: example
|
||||
spec:
|
||||
collectors:
|
||||
- tcpLoadBalancer:
|
||||
collectorName: LB1
|
||||
address: 10.1.1.1
|
||||
port: 6443
|
||||
timeout: 5000ms
|
||||
- diskUsage:
|
||||
collectorName: ephemeral
|
||||
path: /var/lib/kubelet
|
||||
analyzers:
|
||||
- cpu:
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "< 4"
|
||||
message: This server has less than 4 CPU cores, and we require 8, but recommend 16
|
||||
- warn:
|
||||
when: "< 16"
|
||||
message: This server has at least 4 CPU cores, but we recommend 16 or more
|
||||
- pass:
|
||||
message: This server has sufficient CPU cores
|
||||
- tcpLoadBalancer:
|
||||
collectorName: LB1
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "connection-timeout"
|
||||
message: The TCP Load Balancer is not forwarding traffic to this server.
|
||||
- fail:
|
||||
when: "address-in-use"
|
||||
message: The local port is not available to validate the Load Balancer configuration.
|
||||
- pass:
|
||||
when: "connected"
|
||||
message: The specified TCP Load Balancer appears to be properly forwarding traffic to this server.
|
||||
- diskUsage:
|
||||
collectorName: ephemeral
|
||||
outcomes:
|
||||
- fail:
|
||||
when: "total < 20Gi"
|
||||
message: /var/lib/kubelet has less than 20Gi of total space
|
||||
- fail:
|
||||
when: "available < 10Gi"
|
||||
message: /var/lib/kubelet has less than 10Gi of disk space available
|
||||
- fail:
|
||||
when: "used/total > 70%"
|
||||
message: /var/lib/kubelet is more than 70% full
|
||||
- pass:
|
||||
message: /var/lib/kubelet has sufficient disk space available
|
||||
@@ -133,7 +133,6 @@ func verifyConnectionToServer(conn net.Conn, requestToken []byte, responseToken
|
||||
|
||||
_, err := conn.Write(requestToken)
|
||||
if err != nil {
|
||||
fmt.Printf("Client failed to write: %v", err)
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -145,7 +144,6 @@ func verifyConnectionToServer(conn net.Conn, requestToken []byte, responseToken
|
||||
buf := make([]byte, 1024)
|
||||
_, err = conn.Read(buf)
|
||||
if err != nil {
|
||||
fmt.Printf("Client failed to read: %v", err)
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user