### Install Istio Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/istio.md Install Istio using the istioctl command-line tool with default settings. ```bash istioctl install -y ``` -------------------------------- ### kwokctl start help options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_start.md Displays help information for the start command, including available options. ```bash -h, --help help for start ``` -------------------------------- ### kwokctl start command usage Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_start.md Basic syntax for using the kwokctl start command. Specify the command and any relevant flags. ```bash kwokctl start [command] [flags] ``` -------------------------------- ### Install Kwok with WinGet Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/user/installation.md Installs kwok and kwokctl on Windows systems using WinGet. ```bash winget install --id=Kubernetes.kwok -e winget install --id=Kubernetes.kwokctl -e ``` -------------------------------- ### Start Kwok-controller Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster.txt Starts the kwok-controller with specified configurations, including cluster management settings, kubeconfig, and TLS certificates. Output is logged to kwok-controller.log and the process ID is saved to kwok-controller.pid. ```bash cd /workdir/clusters/ && kwok-controller --manage-all-nodes=true --kubeconfig=/workdir/clusters//kubeconfig.yaml --config=/workdir/clusters//kwok.yaml --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key --node-ip= --node-name=localhost --node-port=32763 --server-address=0.0.0.0:32763 --node-lease-duration-seconds=200 >/workdir/clusters//logs/kwok-controller.log 2>&1 & echo $! >/workdir/clusters//pids/kwok-controller.pid ``` -------------------------------- ### Start a cluster command Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_start_cluster.md The basic command to start a cluster. Use flags to customize the behavior. ```bash kwokctl start cluster [flags] ``` -------------------------------- ### Deploy VPA Recommender Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/scalability/scale-using-vpa/_index.md Starts the VPA recommender component. This requires navigating to the correct directory and running the Go application. ```bash { cd autoscaler/vertical-pod-autoscaler/ && NAMESPACE=kube-system go run ./pkg/recommender --kubeconfig ~/.kube/config ;} & ``` -------------------------------- ### Start Kwok-controller Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts the Kwok controller with configurations for node management, kubeconfig, TLS certificates, node details, server address, lease duration, and tracing. Logs are redirected to kwok-controller.log and the process ID is saved. ```bash cd /workdir/clusters/ && kwok-controller --manage-all-nodes=true --kubeconfig=/workdir/clusters//kubeconfig.yaml --config=/workdir/clusters//kwok.yaml --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key --node-ip= --node-name=localhost --node-port=10247 --server-address=0.0.0.0:10247 --node-lease-duration-seconds=200 --tracing-endpoint=127.0.0.1:32764 --tracing-sampling-rate-per-million=1000000 >/workdir/clusters//logs/kwok-controller.log 2>&1 & echo $! >/workdir/clusters//pids/kwok-controller.pid ``` -------------------------------- ### Install Linkerd Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/linkerd.md These commands install Linkerd, first applying the Custom Resource Definitions (CRDs) and then the main installation. ```bash linkerd check --pre linkerd install --crds | kubectl apply -f - linkerd install | kubectl apply -f - ``` -------------------------------- ### Install Kwok with Golang Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/user/installation.md Installs kwokctl and kwok binaries using Golang, fetching the latest release tag from the GitHub repository. ```bash # KWOK repository KWOK_REPO=kubernetes-sigs/kwok # Get latest KWOK_LATEST_RELEASE=$(curl "https://api.github.com/repos/${KWOK_REPO}/releases/latest" | jq -r '.tag_name') go install sigs.k8s.io/kwok/cmd/{kwok,kwokctl}@${KWOK_LATEST_RELEASE} ``` -------------------------------- ### Start Prometheus Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts Prometheus with a specified configuration file and listen address. Logs are redirected to prometheus.log and the process ID is saved. ```bash cd /workdir/clusters/ && prometheus --config.file=/workdir/clusters//prometheus.yaml --web.listen-address=0.0.0.0:9090 >/workdir/clusters//logs/prometheus.log 2>&1 & echo $! >/workdir/clusters//pids/prometheus.pid ``` -------------------------------- ### Directory and Image Setup for Kwok Cluster Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/docker/create_cluster_with_extra.txt This snippet shows the initial setup for creating a Kwok cluster, including directory creation and pulling required Docker images. It prepares the environment for cluster configuration. ```bash mkdir -p /workdir/clusters/ mkdir -p /workdir/clusters//pki # Generate PKI to /workdir/clusters//pki mkdir -p /workdir/clusters//etcd docker pull registry.k8s.io/etcd:3.6.10-0 docker pull registry.k8s.io/kube-apiserver:v1.36.1 docker pull registry.k8s.io/kube-controller-manager:v1.36.1 docker pull registry.k8s.io/kube-scheduler:v1.36.1 docker pull registry.k8s.io/kwok/kwok:v0.8.0 docker pull docker.io/prom/prometheus:v3.8.1 ``` -------------------------------- ### Start Metrics-server Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts the metrics-server with configurations for kubelet address types, TLS, metric resolution, bind address, secure port, and kubeconfig for authentication and authorization. Logs are redirected to metrics-server.log and the process ID is saved. ```bash cd /workdir/clusters/ && metrics-server --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --kubelet-use-node-status-port --kubelet-insecure-tls --metric-resolution=15s --bind-address=0.0.0.0 --secure-port=32763 --kubeconfig=/workdir/clusters//kubeconfig.yaml --authentication-kubeconfig=/workdir/clusters//kubeconfig.yaml --authorization-kubeconfig=/workdir/clusters//kubeconfig.yaml --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key >/workdir/clusters//logs/metrics-server.log 2>&1 & echo $! >/workdir/clusters//pids/metrics-server.pid ``` -------------------------------- ### Setup Export Directory and Copy Configuration Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/kind/export_logs.txt Initializes the log export directory structure and copies the cluster configuration file. ```bash mkdir -p /workdir/clusters//export/logs cp /workdir/clusters//kwok.yaml /workdir/clusters//export/logs/kwok.yaml ``` -------------------------------- ### Cluster start options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_start_cluster.md Options specific to starting a cluster, such as setting a timeout or wait duration. ```bash -h, --help help for cluster --timeout duration Timeout for waiting for the cluster to be started --wait duration Wait for the cluster to be ready ``` -------------------------------- ### Deploy VPA Updater Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/scalability/scale-using-vpa/_index.md Starts the VPA updater component. This requires navigating to the correct directory and running the Go application. ```bash { cd autoscaler/vertical-pod-autoscaler/ && NAMESPACE=kube-system go run ./pkg/updater --kubeconfig ~/.kube/config ;} & ``` -------------------------------- ### Start etcd Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts an etcd instance with specified configurations for compaction, quota, data directory, peer URLs, client URLs, cluster peers, and distributed tracing. Logs are redirected to etcd.log and the process ID is saved. ```bash cd /workdir/clusters/ && etcd --name=node0 --auto-compaction-retention=1 --quota-backend-bytes=8589934592 --data-dir=/workdir/clusters//etcd --initial-advertise-peer-urls=http://0.0.0.0:32766 --listen-peer-urls=http://0.0.0.0:32766 --advertise-client-urls=http://0.0.0.0:2400 --listen-client-urls=http://0.0.0.0:2400 --initial-cluster=node0=http://0.0.0.0:32766 --experimental-enable-distributed-tracing=true --experimental-distributed-tracing-address=127.0.0.1:32764 --experimental-distributed-tracing-sampling-rate=1000000 >/workdir/clusters//logs/etcd.log 2>&1 & echo $! >/workdir/clusters//pids/etcd.pid ``` -------------------------------- ### Start Cluster Components with Nerdctl Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/nerdctl/create_cluster.txt Starts the previously created and configured cluster components: etcd, kube-apiserver, kube-controller-manager, kube-scheduler, and kwok-controller. ```bash nerdctl start kwok--etcd ``` ```bash nerdctl start kwok--kube-apiserver ``` ```bash nerdctl start kwok--kube-controller-manager ``` ```bash nerdctl start kwok--kube-scheduler ``` ```bash nerdctl start kwok--kwok-controller ``` -------------------------------- ### Install kwok Binary Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/user/installation.md Downloads the kwok binary for the current OS and architecture, makes it executable, and moves it to the system's PATH. ```bash wget -O kwok -c "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwok-$(go env GOOS)-$(go env GOARCH)" chmod +x kwok sudo mv kwok /usr/local/bin/kwok ``` -------------------------------- ### Start Kube-scheduler Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts the Kubernetes scheduler with configurations for kubeconfig, authorization, bind address, and secure port. Logs are redirected to kube-scheduler.log and the process ID is saved. ```bash cd /workdir/clusters/ && kube-scheduler --kubeconfig=/workdir/clusters//kubeconfig.yaml --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics --bind-address=0.0.0.0 --secure-port=10250 >/workdir/clusters//logs/kube-scheduler.log 2>&1 & echo $! >/workdir/clusters//pids/kube-scheduler.pid ``` -------------------------------- ### List Kubernetes Contexts Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/performance/control-plane/multi-cluster/_index.md After creating clusters, this command lists all available Kubernetes contexts to verify the setup. ```bash kubectl config get-contexts ``` -------------------------------- ### Install kwokctl Binary Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/user/installation.md Downloads the kwokctl binary for the current OS and architecture, makes it executable, and moves it to the system's PATH. ```bash wget -O kwokctl -c "https://github.com/${KWOK_REPO}/releases/download/${KWOK_LATEST_RELEASE}/kwokctl-$(go env GOOS)-$(go env GOARCH)" chmod +x kwokctl sudo mv kwokctl /usr/local/bin/kwokctl ``` -------------------------------- ### Start etcd with Verbose Logging Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_verbosity.txt Starts an etcd instance with detailed configuration for data storage, peer communication, client access, and distributed tracing. Logs are redirected to etcd.log and the process ID is saved. ```shell cd /workdir/clusters/ && etcd --name=node0 --auto-compaction-retention=1 --quota-backend-bytes=8589934592 --data-dir=/workdir/clusters//etcd --initial-advertise-peer-urls=http://0.0.0.0:32766 --listen-peer-urls=http://0.0.0.0:32766 --advertise-client-urls=http://0.0.0.0:32765 --listen-client-urls=http://0.0.0.0:32765 --initial-cluster=node0=http://0.0.0.0:32766 --experimental-enable-distributed-tracing=true --experimental-distributed-tracing-address=127.0.0.1:32762 --experimental-distributed-tracing-sampling-rate=1000000 >/workdir/clusters//logs/etcd.log 2>&1 & echo $! >/workdir/clusters//pids/etcd.pid ``` -------------------------------- ### Configure and Run Metrics Server Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_verbosity.txt Starts the metrics-server with specified configurations for Kubelet communication, TLS, and logging. The process is run in the background and its PID is saved. ```bash cd /workdir/clusters/ && metrics-server --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname --kubelet-use-node-status-port --kubelet-insecure-tls --metric-resolution=15s --bind-address=0.0.0.0 --secure-port=32759 --kubeconfig=/workdir/clusters//kubeconfig --authentication-kubeconfig=/workdir/clusters//kubeconfig --authorization-kubeconfig=/workdir/clusters//kubeconfig --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key >/workdir/clusters//logs/metrics-server.log 2>&1 & echo $! >/workdir/clusters//pids/metrics-server.pid ``` -------------------------------- ### Set Up Default Stage Policy Source: https://github.com/kubernetes-sigs/kwok/blob/main/charts/metrics-usage/README.md Configures the pod/node emulation behavior for KWOK. This setup is required for KWOK to function correctly. ```shell helm upgrade --install kwok kwok/stage-fast ``` -------------------------------- ### Start Kube-controller-manager Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster.txt Starts the Kubernetes controller manager. Requires a kubeconfig file and specifies authorization paths. Output is logged to kube-controller-manager.log and the process ID is saved to kube-controller-manager.pid. ```bash cd /workdir/clusters/ && kube-controller-manager --node-monitor-period=25s --node-monitor-grace-period=3m20s --kubeconfig=/workdir/clusters//kubeconfig.yaml --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics --bind-address=0.0.0.0 --secure-port=32762 --kube-api-qps=5000 --kube-api-burst=10000 >/workdir/clusters//logs/kube-controller-manager.log 2>&1 & echo $! >/workdir/clusters//pids/kube-controller-manager.pid ``` -------------------------------- ### Start Kube-controller-manager Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts the Kubernetes controller manager with configurations for node monitoring, kubeconfig, authorization, bind address, secure port, and root CA. Logs are redirected to kube-controller-manager.log and the process ID is saved. ```bash cd /workdir/clusters/ && kube-controller-manager --node-monitor-period=25s --node-monitor-grace-period=3m20s --kubeconfig=/workdir/clusters//kubeconfig.yaml --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics --bind-address=0.0.0.0 --secure-port=10260 --root-ca-file=/workdir/clusters//pki/ca.crt --service-account-private-key-file=/workdir/clusters//pki/admin.key >/workdir/clusters//logs/kube-controller-manager.log 2>&1 & echo $! >/workdir/clusters//pids/kube-controller-manager.pid ``` -------------------------------- ### Start etcd Server Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_extra.txt Starts an etcd server for the cluster. Ensure the data directory and log file paths are correctly configured. ```shell cd /workdir/clusters/ && TEST_KEY=TEST_VALUE etcd --name=node0 --auto-compaction-retention=1 --quota-backend-bytes=8589934592 --data-dir=/workdir/clusters//etcd --initial-advertise-peer-urls=http://0.0.0.0:32766 --listen-peer-urls=http://0.0.0.0:32766 --advertise-client-urls=http://0.0.0.0:32765 --listen-client-urls=http://0.0.0.0:32765 --initial-cluster=node0=http://0.0.0.0:32766 --log-level=debug >/workdir/clusters//logs/etcd.log 2>&1 & echo $! >/workdir/clusters//pids/etcd.pid ``` -------------------------------- ### Deploy VPA Admission Controller Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/scalability/scale-using-vpa/_index.md Starts the VPA admission controller component. This requires navigating to the correct directory and running the Go application with specific flags for configuration and networking. ```bash { cd autoscaler/vertical-pod-autoscaler/ && NAMESPACE=kube-system go run ./pkg/admission-controller --kubeconfig ~/.kube/config --client-ca-file ~/.kwok/clusters/kwok/pki/ca.crt --tls-cert-file ~/.kwok/clusters/kwok/pki/admin.crt --tls-private-key ~/.kwok/clusters/kwok/pki/admin.key --webhook-address https://127.0.0.1 --webhook-port 8080 --register-by-url --port 8080 ;} & ``` -------------------------------- ### Start Kube-apiserver Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts the Kubernetes API server with configurations for etcd, authorization, TLS certificates, service account keys, and tracing. Logs are redirected to kube-apiserver.log and the process ID is saved. ```bash cd /workdir/clusters/ && kube-apiserver --etcd-prefix=/registry --allow-privileged=true --etcd-servers=http://127.0.0.1:2400 --authorization-mode=Node,RBAC --bind-address=0.0.0.0 --secure-port=32765 --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key --client-ca-file=/workdir/clusters//pki/ca.crt --service-account-key-file=/workdir/clusters//pki/admin.key --service-account-signing-key-file=/workdir/clusters//pki/admin.key --service-account-issuer=https://kubernetes.default.svc.cluster.local --proxy-client-key-file=/workdir/clusters//pki/admin.key --proxy-client-cert-file=/workdir/clusters//pki/admin.crt --tracing-config-file=/workdir/clusters//apiserver-tracing-config.yaml >/workdir/clusters//logs/kube-apiserver.log 2>&1 & echo $! >/workdir/clusters//pids/kube-apiserver.pid ``` -------------------------------- ### Start Kube-scheduler Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster.txt Starts the Kubernetes scheduler. Requires a kubeconfig file and specifies authorization paths. Output is logged to kube-scheduler.log and the process ID is saved to kube-scheduler.pid. ```bash cd /workdir/clusters/ && kube-scheduler --kubeconfig=/workdir/clusters//kubeconfig.yaml --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics --bind-address=0.0.0.0 --secure-port=32761 --kube-api-qps=5000 --kube-api-burst=10000 >/workdir/clusters//logs/kube-scheduler.log 2>&1 & echo $! >/workdir/clusters//pids/kube-scheduler.pid ``` -------------------------------- ### Set Up Default Metrics Usage Policy Source: https://github.com/kubernetes-sigs/kwok/blob/main/charts/metrics-usage/README.md Installs the metrics usage chart for KWOK. This is an optional configuration that enables default metrics usage policies. ```shell helm upgrade --install kwok kwok/metrics-usage ``` -------------------------------- ### Start Kube-apiserver Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster.txt Starts the Kubernetes API server. Configuration includes etcd server address, TLS certificates, and service account keys. Output is logged to kube-apiserver.log and the process ID is saved to kube-apiserver.pid. ```bash cd /workdir/clusters/ && kube-apiserver --etcd-prefix=/registry --allow-privileged=true --max-requests-inflight=0 --max-mutating-requests-inflight=0 --enable-priority-and-fairness=false --etcd-servers=http://127.0.0.1:32765 --bind-address=0.0.0.0 --secure-port=32764 --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key --client-ca-file=/workdir/clusters//pki/ca.crt --service-account-key-file=/workdir/clusters//pki/admin.key --service-account-signing-key-file=/workdir/clusters//pki/admin.key --service-account-issuer=https://kubernetes.default.svc.cluster.local --proxy-client-key-file=/workdir/clusters//pki/admin.key --proxy-client-cert-file=/workdir/clusters//pki/admin.crt >/workdir/clusters//logs/kube-apiserver.log 2>&1 & echo $! >/workdir/clusters//pids/kube-apiserver.pid ``` -------------------------------- ### Deploy Kueue Controller-Manager Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/kueue.md Installs the Kueue controller-manager using a server-side apply with the provided manifest URL. ```bash kubectl apply --server-side -f https://github.com/kubernetes-sigs/kueue/releases/download/v0.14.4/manifests.yaml ``` -------------------------------- ### Start Kube-apiserver Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_extra.txt Launches the Kubernetes API server. This command requires a valid certificate, key, and CA file, and specifies etcd server endpoints. ```shell cd /workdir/clusters/ && TEST_KEY=TEST_VALUE kube-apiserver --etcd-prefix=/registry --allow-privileged=true --max-requests-inflight=0 --max-mutating-requests-inflight=0 --enable-priority-and-fairness=false --etcd-servers=http://127.0.0.1:32765 --authorization-mode=Node,RBAC --bind-address=0.0.0.0 --secure-port=32764 --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key --client-ca-file=/workdir/clusters//pki/ca.crt --service-account-key-file=/workdir/clusters//pki/admin.key --service-account-signing-key-file=/workdir/clusters//pki/admin.key --service-account-issuer=https://kubernetes.default.svc.cluster.local --proxy-client-key-file=/workdir/clusters//pki/admin.key --proxy-client-cert-file=/workdir/clusters//pki/admin.crt --v=5 >/workdir/clusters//logs/kube-apiserver.log 2>&1 & echo $! >/workdir/clusters//pids/kube-apiserver.pid ``` -------------------------------- ### Start Jaeger with Verbose Logging Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_verbosity.txt Launches a Jaeger instance configured for OTLP collection and exposes its query service. Logs are redirected to jaeger.log and the process ID is saved. ```shell cd /workdir/clusters/ && jaeger --collector.otlp.enabled=true --query.http-server.host-port=0.0.0.0:16686 --collector.otlp.grpc.host-port=127.0.0.1:32762 >/workdir/clusters//logs/jaeger.log 2>&1 & echo $! >/workdir/clusters//pids/jaeger.pid ``` -------------------------------- ### Deploy Sample RayJob Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/ray.md Applies a sample RayJob manifest to test the integrated setup. This job is a PyTorch MNIST example. ```bash kubectl apply -f https://raw.githubusercontent.com/ray-project/kuberay/master/ray-operator/config/samples/pytorch-mnist/ray-job.pytorch-mnist.yaml ``` -------------------------------- ### Deploy Application and Inject Sidecar Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/linkerd.md This example first applies a sample application (emojivoto) and then injects the Linkerd sidecar proxy into its deployments. ```bash kubectl apply -f https://run.linkerd.io/emojivoto.yml kubectl get -n emojivoto deploy -o yaml | linkerd inject - | kubectl apply -f - ``` -------------------------------- ### Install KWOK Chart Source: https://github.com/kubernetes-sigs/kwok/blob/main/charts/metrics-usage/README.md Installs or upgrades the KWOK chart in the 'kube-system' namespace. This is the primary installation command for KWOK. ```shell helm upgrade --namespace kube-system --install kwok kwok/kwok ``` -------------------------------- ### Prepare Kind Cluster Directories Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/kind/create_cluster_with_verbosity.txt Sets up the necessary directory structure for a Kind cluster, including directories for PKI, manifests, and logs. This is a prerequisite for cluster creation. ```bash mkdir -p /workdir/clusters//pki docker pull docker.io/kindest/node:v1.36.1 mkdir -p /workdir/clusters//pki mkdir -p /workdir/clusters//manifests mkdir -p /workdir/clusters//logs touch /workdir/clusters//logs/audit.log cp /test/kwokctl/audit-policy.yaml /workdir/clusters//audit.yaml ``` -------------------------------- ### Directory Setup for Cluster Configuration Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/docker/create_cluster.txt Creates necessary directories for storing cluster configuration and PKI files. This is a prerequisite for generating cluster artifacts. ```bash mkdir -p /workdir/clusters/ mkdir -p /workdir/clusters//pki mkdir -p /workdir/clusters//etcd ``` -------------------------------- ### Start Kube-controller-manager Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_extra.txt Initializes the Kubernetes controller manager. Requires a kubeconfig file and specifies TLS certificates for secure communication. ```shell cd /workdir/clusters/ && TEST_KEY=TEST_VALUE kube-controller-manager --node-monitor-period=25s --node-monitor-grace-period=3m20s --kubeconfig=/workdir/clusters//kubeconfig.yaml --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics --bind-address=0.0.0.0 --secure-port=32762 --root-ca-file=/workdir/clusters//pki/ca.crt --service-account-private-key-file=/workdir/clusters//pki/admin.key --kube-api-qps=5000 --kube-api-burst=10000 --v=5 >/workdir/clusters//logs/kube-controller-manager.log 2>&1 & echo $! >/workdir/clusters//pids/kube-controller-manager.pid ``` -------------------------------- ### kwokctl get Options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get.md Help flag for the get command. Use this to display help information specific to the get subcommand. ```bash -h, --help help for get ``` -------------------------------- ### Prepare Artifacts and Kustomize Configuration Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/release/testdata/manifests-with-push-ghrelease.txt Creates a directory for artifacts and copies the kustomize configuration into it. Navigates into the kustomize directory for subsequent modifications. ```bash mkdir -p ./artifacts cp -r ./kustomize ./artifacts/ cd ./artifacts/kustomize/kwok ``` -------------------------------- ### Start Kwok-controller with Verbose Logging Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_verbosity.txt Launches the kwok-controller with options to manage all nodes, configure TLS, specify node details, and enable tracing. Logs are redirected to kwok-controller.log and the process ID is saved. ```shell cd /workdir/clusters/ && kwok-controller --manage-all-nodes=true --kubeconfig=/workdir/clusters//kubeconfig --config=/workdir/clusters//kwok.yaml --tls-cert-file=/workdir/clusters//pki/admin.crt --tls-private-key-file=/workdir/clusters//pki/admin.key --node-ip= --node-name=localhost --node-port=32763 --server-address=0.0.0.0:32763 --node-lease-duration-seconds=200 --tracing-endpoint=127.0.0.1:32762 --tracing-sampling-rate-per-million=1000000 >/workdir/clusters//logs/kwok-controller.log 2>&1 & echo $! >/workdir/clusters//pids/kwok-controller.pid ``` -------------------------------- ### Prepare Artifacts Directory Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/release/testdata/manifests-with-push-bucket.txt Creates a directory for artifacts and copies kustomize configurations into it. ```bash mkdir -p ./artifacts cp -r ./kustomize ./artifacts/ ``` -------------------------------- ### Set up Cluster with Metrics Server Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/metrics-server.md Create a Kubernetes cluster using kwokctl, enabling the metrics server and applying the metrics-usage.yaml configuration. ```bash kwokctl create cluster --enable-metrics-server -c metrics-usage.yaml ``` -------------------------------- ### Install Kwok with Homebrew Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/user/installation.md Installs the latest version of kwok and kwokctl on Linux/MacOS systems using Homebrew. ```bash brew install kwok ``` -------------------------------- ### Demo Steps Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/injectfailure/_index.md This bash script outlines the steps to execute the init container error injection demo. ```bash kubectl apply -f virtual-gpu-node.yaml kubectl apply -f failed-pod.yaml kubectl logs -f failed-pod ``` -------------------------------- ### kwokctl get clusters flags Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get_clusters.md Flags for the `get clusters` command, including help and output formatting options. ```bash -h, --help help for clusters -o, --output string Output format (name, wide) (default "name") ``` -------------------------------- ### kwokctl get components Options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get_components.md Available options for the `kwokctl get components` command, including output formatting. ```bash -h, --help help for components -o, --output string Output format (name, wide) (default "name") ``` -------------------------------- ### Build and Copy Kwokctl for Windows (Generic Arch) Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/release/testdata/cross-build-with-push-staging.txt Builds the Kwokctl binary for Windows with a placeholder architecture and copies it to the staging bucket. ```bash GOOS=windows GOARCH= go build -ldflags '-X sigs.k8s.io/kwok/pkg/consts.Version= -X sigs.k8s.io/kwok/pkg/consts.KubeVersion=v1.28.0' -o ./bin/windows//kwokctl.exe ./cmd/kwokctl gsutil cp -P ./bin/windows//kwokctl.exe bucket/releases/prefix-/bin/windows//kwokctl.exe ``` -------------------------------- ### Install KubeRay Operator Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/ray.md Installs the KubeRay operator using Helm. This operator manages Ray clusters within Kubernetes. ```bash helm install kuberay-operator kuberay/kuberay-operator --version 1.4.2 ``` -------------------------------- ### Start Kube-scheduler Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_extra.txt Starts the Kubernetes scheduler. This command requires a kubeconfig file and sets API server query rates. ```shell cd /workdir/clusters/ && TEST_KEY=TEST_VALUE kube-scheduler --kubeconfig=/workdir/clusters//kubeconfig.yaml --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics --bind-address=0.0.0.0 --secure-port=32761 --kube-api-qps=5000 --kube-api-burst=10000 --v=5 >/workdir/clusters//logs/kube-scheduler.log 2>&1 & echo $! >/workdir/clusters//pids/kube-scheduler.pid ``` -------------------------------- ### Set up Kwokctl and Create Cluster with Github Action Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/user/github-action.md This snippet demonstrates how to set up kwokctl using the Kwok Github Action and then create a Kubernetes cluster. The Kubernetes version can be specified via an environment variable. ```yaml - name: Set up kwokctl uses: kubernetes-sigs/kwok@main with: command: kwokctl - run: kwokctl create cluster env: KWOK_KUBE_VERSION: v1.28.0 ``` -------------------------------- ### Start etcd Server Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster.txt Starts an etcd server for the cluster. Logs are redirected to etcd.log and the process ID is saved to etcd.pid. ```bash cd /workdir/clusters/ && etcd --name=node0 --auto-compaction-retention=1 --quota-backend-bytes=8589934592 --data-dir=/workdir/clusters//etcd --initial-advertise-peer-urls=http://0.0.0.0:32766 --listen-peer-urls=http://0.0.0.0:32766 --advertise-client-urls=http://0.0.0.0:32765 --listen-client-urls=http://0.0.0.0:32765 --initial-cluster=node0=http://0.0.0.0:32766 >/workdir/clusters//logs/etcd.log 2>&1 & echo $! >/workdir/clusters//pids/etcd.pid ``` -------------------------------- ### kwokctl get artifacts Options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get_artifacts.md These are the specific options available for the `kwokctl get artifacts` command, including filtering and runtime selection. ```bash --filter string Filter the list of (binary or image) ``` ```bash -h, --help help for artifacts ``` ```bash --runtime string Runtime of the cluster (binary or docker or finch or kind or kind-finch or kind-lima or kind-nerdctl or kind-podman or lima or nerdctl or podman) ``` -------------------------------- ### Build and Copy KwoK for Windows (Generic Arch) Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/release/testdata/cross-build-with-push-staging.txt Builds the KwoK binary for Windows with a placeholder architecture and copies it to the staging bucket. ```bash GOOS=windows GOARCH= go build -ldflags '-X sigs.k8s.io/kwok/pkg/consts.Version= -X sigs.k8s.io/kwok/pkg/consts.KubeVersion=v1.28.0' -o ./bin/windows//kwok.exe ./cmd/kwok gsutil cp -P ./bin/windows//kwok.exe bucket/releases/prefix-/bin/windows//kwok.exe ``` -------------------------------- ### kwokctl get components Command Usage Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get_components.md Basic usage of the `kwokctl get components` command. Use this to list cluster components. ```bash kwokctl get components [flags] ``` -------------------------------- ### Start Prometheus Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_extra.txt Starts a Prometheus server for monitoring. This command requires a configuration file and specifies the listening address and log level. ```shell cd /workdir/clusters/ && TEST_KEY=TEST_VALUE prometheus --config.file=/workdir/clusters//prometheus.yaml --web.listen-address=0.0.0.0:9090 --log.level=debug >/workdir/clusters//logs/prometheus.log 2>&1 & echo $! >/workdir/clusters//pids/prometheus.pid ``` -------------------------------- ### kwokctl get artifacts Command Usage Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get_artifacts.md This is the basic usage of the `kwokctl get artifacts` command. It lists binaries or images used by the cluster. ```bash kwokctl get artifacts [flags] ``` -------------------------------- ### Prepare Cluster Directories and Files Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/docker/create_cluster_with_verbosity.txt This snippet shows the commands to create necessary directories and touch log files for a Kubernetes cluster configuration. It also copies an audit policy file. ```bash mkdir -p /workdir/clusters/ mkdir -p /workdir/clusters//pki # Generate PKI to /workdir/clusters//pki mkdir -p /workdir/clusters//logs touch /workdir/clusters//logs/audit.log cp /test/kwokctl/audit-policy.yaml /workdir/clusters//audit.yaml mkdir -p /workdir/clusters//etcd ``` -------------------------------- ### kwokctl get artifacts Inherited Parent Command Options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get_artifacts.md These options are inherited from parent commands and can be used with `kwokctl get artifacts` for configuration and logging. ```bash -c, --config strings config path (default [~/.kwok/kwok.yaml]) ``` ```bash --dry-run Print the command that would be executed, but do not execute it ``` ```bash --name string cluster name (default "kwok") ``` ```bash -v, --v log-level number for the log level verbosity (DEBUG, INFO, WARN, ERROR) or (-4, 0, 4, 8) (default INFO) ``` -------------------------------- ### Build and Copy KwoK for Windows (ARM64) Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/release/testdata/cross-build-with-push-staging.txt Builds the KwoK binary for Windows on ARM64 architecture and copies it to the staging bucket. ```bash GOOS=windows GOARCH=arm64 go build -ldflags '-X sigs.k8s.io/kwok/pkg/consts.Version= -X sigs.k8s.io/kwok/pkg/consts.KubeVersion=v1.28.0' -o ./bin/windows/arm64/kwok.exe ./cmd/kwok gsutil cp -P ./bin/windows/arm64/kwok.exe bucket/releases/prefix-/bin/windows/arm64/kwok.exe ``` -------------------------------- ### Build and Copy Kwokctl for Windows (ARM64) Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/release/testdata/cross-build-with-push-staging.txt Builds the Kwokctl binary for Windows on ARM64 architecture and copies it to the staging bucket. ```bash GOOS=windows GOARCH=arm64 go build -ldflags '-X sigs.k8s.io/kwok/pkg/consts.Version= -X sigs.k8s.io/kwok/pkg/consts.KubeVersion=v1.28.0' -o ./bin/windows/arm64/kwokctl.exe ./cmd/kwokctl gsutil cp -P ./bin/windows/arm64/kwokctl.exe bucket/releases/prefix-/bin/windows/arm64/kwokctl.exe ``` -------------------------------- ### Start Jaeger Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/start_cluster.txt Starts a Jaeger instance with OTLP collector enabled and query HTTP server configured. Logs are redirected to jaeger.log and the process ID is saved. ```bash cd /workdir/clusters/ && jaeger --collector.otlp.enabled=true --query.http-server.host-port=0.0.0.0:16686 --collector.otlp.grpc.host-port=127.0.0.1:32764 >/workdir/clusters//logs/jaeger.log 2>&1 & echo $! >/workdir/clusters//pids/jaeger.pid ``` -------------------------------- ### Start Kube-scheduler with Verbose Logging Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/binary/create_cluster_with_verbosity.txt Starts the Kubernetes scheduler with a configuration file and settings for API access limits. Logs are redirected to kube-scheduler.log and the process ID is saved. ```shell cd /workdir/clusters/ && kube-scheduler --config=/workdir/clusters//scheduler.yaml --authorization-always-allow-paths=/healthz,/readyz,/livez,/metrics --bind-address=0.0.0.0 --secure-port=32760 --kube-api-qps=5000 --kube-api-burst=10000 >/workdir/clusters//logs/kube-scheduler.log 2>&1 & echo $! >/workdir/clusters//pids/kube-scheduler.pid ``` -------------------------------- ### kwokctl get kubeconfig Options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get_kubeconfig.md These are the specific options available for the `get kubeconfig` command. They allow customization of the kubeconfig output, such as specifying signing certificate groups, hosts, and user. ```bash --group strings Signing certificate with the specified groups if modified (default [system:masters]) -h, --help help for kubeconfig --host string Override host[:port] for kubeconfig (default "127.0.0.1") --insecure-skip-tls-verify Skip server certificate verification --user string Signing certificate with the specified user if modified (default "kwok-admin") ``` -------------------------------- ### Prepare Variables for Binary Download Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/user/installation.md Sets up variables for the KWOK repository and the latest release tag, used for downloading binaries. ```bash # KWOK repository KWOK_REPO=kubernetes-sigs/kwok # Get latest KWOK_LATEST_RELEASE=$(curl "https://api.github.com/repos/${KWOK_REPO}/releases/latest" | jq -r '.tag_name') ``` -------------------------------- ### kwokctl get Command Syntax Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_get.md Basic syntax for using the kwokctl get command. Specify the desired resource type (e.g., artifacts, clusters, components, kubeconfig) as the command argument. ```bash kwokctl get [command] [flags] ``` -------------------------------- ### Build and Copy Kwokctl for Linux (Generic Arch) Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/release/testdata/cross-build-with-push-staging.txt Builds the Kwokctl binary for Linux with a placeholder architecture and copies it to the staging bucket. ```bash GOOS=linux GOARCH= go build -ldflags '-X sigs.k8s.io/kwok/pkg/consts.Version= -X sigs.k8s.io/kwok/pkg/consts.KubeVersion=v1.28.0' -o ./bin/linux//kwokctl ./cmd/kwokctl gsutil cp -P ./bin/linux//kwokctl bucket/releases/prefix-/bin/linux//kwokctl ``` -------------------------------- ### Scale node and set allocatable resources Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/examples/scheduling/pod-priority-and-preemption/_index.md Create a node and specify its allocatable CPU resources using kwokctl. ```bash kwokctl scale node --replicas 1 --param '.allocatable.cpu="4000m"' ``` -------------------------------- ### Start Kwok Cluster Components with Nerdctl Source: https://github.com/kubernetes-sigs/kwok/blob/main/test/e2e/kwokctl/dryrun/testdata/nerdctl/create_cluster_with_extra.txt Use these commands to start all the necessary components for a kwok-managed Kubernetes cluster when using nerdctl. Ensure the cluster name is replaced with your specific cluster name. ```bash nerdctl start kwok--etcd nerdctl start kwok--kube-apiserver nerdctl start kwok--kube-controller-manager nerdctl start kwok--kube-scheduler nerdctl start kwok--kwok-controller nerdctl start kwok--prometheus ``` -------------------------------- ### Adopter Configuration Example Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/adopters/_index.md Use this YAML template to define your organization's details when becoming a KWOK adopter. Fill in your name, a description of your use case, your GitHub username, and any relevant links. ```yaml # kwok.yaml name: kwok # your organization or individual name description: This is a new adopter template for others. # description of your use case contacts: - wzshiming # your github username links: - name: kwok.sigs.k8s.io # your link name url: https://kwok.sigs.k8s.io # your link url ``` -------------------------------- ### kwokctl kubectl Help Options Source: https://github.com/kubernetes-sigs/kwok/blob/main/site/content/en/docs/generated/kwokctl_kubectl.md Displays help information specific to the `kubectl` subcommand within `kwokctl`. Use this to understand available actions for managing clusters. ```bash -h, --help help for kubectl ``` -------------------------------- ### Build Kwok Demo Assets Source: https://github.com/kubernetes-sigs/kwok/blob/main/demo/README.md Run this command to clean previous builds and then create all necessary demo assets for Kwok. ```bash make clean all ```