github.com/1aal/kubeblocks@v0.0.0-20231107070852-e1c03e598921/docs/user_docs/cli/kbcli_fault_network_delay.md (about) 1 --- 2 title: kbcli fault network delay 3 --- 4 5 Make pods communicate with other objects lazily. 6 7 ``` 8 kbcli fault network delay [flags] 9 ``` 10 11 ### Examples 12 13 ``` 14 # Isolate all pods network under the default namespace from the outside world, including the k8s internal network. 15 kbcli fault network partition 16 17 # The specified pod is isolated from the k8s external network "kubeblocks.io". 18 kbcli fault network partition mycluster-mysql-1 --external-targets=kubeblocks.io 19 20 # Isolate the network between two pods. 21 kbcli fault network partition mycluster-mysql-1 --target-label=statefulset.kubernetes.io/pod-name=mycluster-mysql-2 22 23 // Like the partition command, the target can be specified through --target-label or --external-targets. The pod only has obstacles in communicating with this target. If the target is not specified, all communication will be blocked. 24 # Block all pod communication under the default namespace, resulting in a 50% packet loss rate. 25 kbcli fault network loss --loss=50 26 27 # Block the specified pod communication, so that the packet loss rate is 50%. 28 kbcli fault network loss mysql-cluster-mysql-2 --loss=50 29 30 kbcli fault network corrupt --corrupt=50 31 32 # Blocks specified pod communication with a 50% packet corruption rate. 33 kbcli fault network corrupt mysql-cluster-mysql-2 --corrupt=50 34 35 kbcli fault network duplicate --duplicate=50 36 37 # Block specified pod communication so that the packet repetition rate is 50%. 38 kbcli fault network duplicate mysql-cluster-mysql-2 --duplicate=50 39 40 kbcli fault network delay --latency=10s 41 42 # Block the communication of the specified pod, causing its network delay for 10s. 43 kbcli fault network delay mysql-cluster-mysql-2 --latency=10s 44 45 # Limit the communication bandwidth between mysql-cluster-mysql-2 and the outside. 46 kbcli fault network bandwidth mysql-cluster-mysql-2 --rate=1kbps --duration=1m 47 ``` 48 49 ### Options 50 51 ``` 52 --annotation stringToString Select the pod to inject the fault according to Annotation. (default []) 53 -c, --correlation string Indicates the probability of a packet error occurring. Value range: [0, 100]. 54 --direction string You can select "to"" or "from"" or "both"". (default "to") 55 --dry-run string[="unchanged"] Must be "client", or "server". If with client strategy, only print the object that would be sent, and no data is actually sent. If with server strategy, submit the server-side request, but no data is persistent. (default "none") 56 --duration string Supported formats of the duration are: ms / s / m / h. (default "10s") 57 -e, --external-target stringArray a network target outside of Kubernetes, which can be an IPv4 address or a domain name, 58 such as "www.baidu.com". Only works with direction: to. 59 -h, --help help for delay 60 --jitter string the variation range of the delay time. 61 --label stringToString label for pod, such as '"app.kubernetes.io/component=mysql, statefulset.kubernetes.io/pod-name=mycluster-mysql-0. (default []) 62 --latency string the length of time to delay. 63 --mode string You can select "one", "all", "fixed", "fixed-percent", "random-max-percent", Specify the experimental mode, that is, which Pods to experiment with. (default "all") 64 --node stringArray Inject faults into pods in the specified node. 65 --node-label stringToString label for node, such as '"kubernetes.io/arch=arm64,kubernetes.io/hostname=minikube-m03,kubernetes.io/os=linux. (default []) 66 --ns-fault stringArray Specifies the namespace into which you want to inject faults. (default [default]) 67 -o, --output format Prints the output in the specified format. Allowed values: JSON and YAML (default yaml) 68 --phase stringArray Specify the pod that injects the fault by the state of the pod. 69 --target-label stringToString label for pod, such as '"app.kubernetes.io/component=mysql, statefulset.kubernetes.io/pod-name=mycluster-mysql-0"' (default []) 70 --target-mode string You can select "one", "all", "fixed", "fixed-percent", "random-max-percent", Specify the experimental mode, that is, which Pods to experiment with. 71 --target-ns-fault stringArray Specifies the namespace into which you want to inject faults. 72 --target-value string If you choose mode=fixed or fixed-percent or random-max-percent, you can enter a value to specify the number or percentage of pods you want to inject. 73 --value string If you choose mode=fixed or fixed-percent or random-max-percent, you can enter a value to specify the number or percentage of pods you want to inject. 74 ``` 75 76 ### Options inherited from parent commands 77 78 ``` 79 --as string Username to impersonate for the operation. User could be a regular user or a service account in a namespace. 80 --as-group stringArray Group to impersonate for the operation, this flag can be repeated to specify multiple groups. 81 --as-uid string UID to impersonate for the operation. 82 --cache-dir string Default cache directory (default "$HOME/.kube/cache") 83 --certificate-authority string Path to a cert file for the certificate authority 84 --client-certificate string Path to a client certificate file for TLS 85 --client-key string Path to a client key file for TLS 86 --cluster string The name of the kubeconfig cluster to use 87 --context string The name of the kubeconfig context to use 88 --disable-compression If true, opt-out of response compression for all requests to the server 89 --insecure-skip-tls-verify If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure 90 --kubeconfig string Path to the kubeconfig file to use for CLI requests. 91 --match-server-version Require server version to match client version 92 -n, --namespace string If present, the namespace scope for this CLI request 93 --request-timeout string The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0") 94 -s, --server string The address and port of the Kubernetes API server 95 --tls-server-name string Server name to use for server certificate validation. If it is not provided, the hostname used to contact the server is used 96 --token string Bearer token for authentication to the API server 97 --user string The name of the kubeconfig user to use 98 ``` 99 100 ### SEE ALSO 101 102 * [kbcli fault network](kbcli_fault_network.md) - Network chaos. 103 104 #### Go Back to [CLI Overview](cli.md) Homepage. 105