k8snetlook

package
v0.0.0-...-760a2b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup()

Cleanup closes all of the open network namespaces handles

func GetReportJSON

func GetReportJSON() string

GetReportJSON returns allChecks object as a JSON string

func Init

func Init(kubeconfigPath string) error

Init initializes k8snetlook

func PrintReport

func PrintReport()

PrintReport prints the summary of the checks

func RunAPIServerHealthCheck

func RunAPIServerHealthCheck() (bool, error)

RunAPIServerHealthCheck checks api server health using livez endpoint

func RunDstConnectivityCheck

func RunDstConnectivityCheck(dstIP string) (bool, error)

RunDstConnectivityCheck checks connectivity to destination specified by dstIP

func RunDstSvcEndpointsConnectivityCheck

func RunDstSvcEndpointsConnectivityCheck(endpoints []Endpoint) (bool, error)

RunDstSvcEndpointsConnectivityCheck checks connectivity from SrcPod to all IPs provided to this checker

func RunGatewayConnectivityCheck

func RunGatewayConnectivityCheck() (bool, error)

RunGatewayConnectivityCheck checks connectivity to default gw

func RunHostChecks

func RunHostChecks()

RunHostChecks runs checks from host network namespace

func RunK8sDNSLookupCheck

func RunK8sDNSLookupCheck(dnsServerIP, dstSvcName, dstSvcNamespace, dstSvcExpectedIP string) (bool, error)

RunK8sDNSLookupCheck checks DNS lookup functionality for a given K8s service

func RunKubeAPIEndpointIPConnectivityCheck

func RunKubeAPIEndpointIPConnectivityCheck() (bool, error)

RunKubeAPIEndpointIPConnectivityCheck checks connectivity to k8s api server via each endpoint (nodeIP)

func RunKubeAPIServiceIPConnectivityCheck

func RunKubeAPIServiceIPConnectivityCheck() (bool, error)

RunKubeAPIServiceIPConnectivityCheck checks connectivity to K8s api service via clusterIP

func RunMTUProbeToDstIPCheck

func RunMTUProbeToDstIPCheck(dstIP string) (bool, error)

RunMTUProbeToDstIPCheck checks path-MTU by probing the traffic path using icmp messages

func RunPodChecks

func RunPodChecks()

RunPodChecks runs checks from within the Pod network namespace

Types

type Check

type Check struct {
	Name     string `json:"name"`
	Success  bool   `json:"success"`
	ErrorMsg error  `json:"error_msg"`
}

Check describes the reporting structure for a network check

type Checker

type Checker struct {
	PodChecks  []Check `json:"pod_checks,omitempty"`
	HostChecks []Check `json:"host_checks"`
}

Checker stores check names and results for all of the checks

type Config

type Config struct {
	SrcPod         Pod
	DstPod         Pod
	DstSvc         Service
	ExternalIP     string
	KubeconfigPath string

	KubeAPIService Endpoint
	KubeDNSService Endpoint
	HostGatewayIP  string
}

Config struct represents the properties required by k8snetlook to run checks most properties are populated from user input

var Cfg Config

Cfg is an instance of Config struct

type Endpoint

type Endpoint struct {
	IP   string
	Port int32
}

Endpoint struct specifies properties that an Endpoint represents

type Pod

type Pod struct {
	Name      string
	Namespace string
	IP        string
	NsHandle  netns.NsHandle // Initializes this with an open FD to the netns file /proc/<pid>/ns/net
}

Pod struct specifies properties required for Pod network debugging

type Service

type Service struct {
	Name         string
	Namespace    string
	ClusterIP    Endpoint
	SvcEndpoints []Endpoint
}

Service struct specifies properties required for decribing a K8s service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL