# Cli Bootstrap

The `bootstrap` command creates a single node cluster using the current node as the master.

## Syntax Example

{% tabs %}
{% tab title="Bash" %}

```bash
pf9ctl bootstrap [flags] <cluster-name>
```

{% endtab %}
{% endtabs %}

## All Available Commands and Flags

{% tabs %}
{% tab title="Bash" %}

```bash
pf9ctl bootstrap --help

Bootstrap a single node Kubernetes cluster with current node as the master node.

Usage:
  pf9ctl bootstrap [flags] cluster-name

Examples:
pf9ctl bootstrap <clusterName> --pmk-version <version>

Required Flags:
	    --pmk-version string                  Kubernetes pmk version
Optional Flags:
	    --advanced-api-configuration string   Allowed API groups and version. Option: default, all & custom
	    --allow-workloads-on-master           Taint master nodes ( to enable workloads ), use either --allow-workloads-on-master or --allow-workloads-on-master=false to change (default true)
	    --api-server-flags strings            Comma separated list of supported kube-apiserver flags, e.g: --request-timeout=2m0s,--kubelet-timeout=20s
	    --block-size string                   Block size determines how many Pod's can run per node vs total number of nodes per cluster (default "26")
	    --container-runtime string            The container runtime for the cluster (default "containerd")
	    --containers-cidr string              CIDR for container overlay (default "10.20.0.0/16")
	    --controller-manager-flags strings    Comma separated list of supported kube-controller-manager flags, e.g: --large-cluster-size-threshold=60,--concurrent-statefulset-syncs=10
	    --enable-kubeVirt                     Enables Kubernetes to run Virtual Machines within Pods. This feature is not recommended for production workloads, use either --enable-kubeVirt or --enable-kubeVirt=true to change
	    --enable-profile-engine               Simplfy cluster governance using the Platform9 Profile Engine, use either --enable-profile-engine or --enable-profile-engine=false to change (default true)
	    --etcd-backup                         Enable automated etcd backups on this cluster, use either --etcd-backup or --etcd-backup=false to change (default true)
	    --external-dns-name string            External DNS for master VIP
	-h, --help                                help for bootstrap
	    --http-proxy string                   Specify the HTTP proxy for this cluster. Format-> <scheme>://<username>:<password>@<host>:<port>, username and password are optional.
	    --interface-detction-method string    Interface detection method for Calico CNI (default "first-found")
	-i, --ip strings                          IP address of the host to be prepared
	    --ip-encapsulation string             Encapsulates POD traffic in IP-in-IP between nodes (default "Always")
	    --master-virtual-interface string     Physical interface for virtual IP association
	    --master-virtual-ip string            Virtual IP address for cluster
	    --metallb-ip-range string             Ip range for MetalLB
	    --mfa string                          MFA token
	    --monitoring                          Enable monitoring for this cluster, use either --monitoring or --monitoring=false to change (default true)
	    --mtu-size string                     Maximum Transmission Unit (MTU) for the interface (default "1440")
	    --nat int                             Packets destined outside the POD network will be SNAT'd using the node's IP (default 1)
	    --network-plugin string               Specify network plugin ( Possible values: flannel or calico ) (default "calico")
	    --network-plugin-operator             Will deploy Platform9 CRDs to enable multiple CNIs and features such as SR-IOV, use either --network-plugin-operator or --network-plugin-operator=true to change
	    --network-stack int                   0 for ipv4 and 1 for ipv6
	-p, --password string                     Ssh password for the node (use 'single quotes' to pass password)
	    --privileged                          Enable privileged mode for K8s API, use either --privileged or --privileged=false to change (default true)
	-r, --remove-existing-pkgs                Will remove previous installation if found, use either --remove-existing-pkgs or --remove-existing-pkgs=true to change
	    --reserved-cpu string                 Comma separated list of CPUs to be reserved for the system, e.g: 4-8,9-12
	    --scheduler-flags strings             Comma separated list of supported Kube-scheduler flags, e.g: --kube-api-burst=120,--log_file_max_size=3000
	    --services-cidr string                CIDR for services overlay (default "10.21.0.0/16")
	-s, --ssh-key string                      Ssh key file for connecting to the node
	-e, --sudo-pass string                    Sudo password for user on remote host
	    --tag string                          Add tag metadata to this cluster (key=value)
            --topology-manager-policy string      Topology manager policy (default "none")
	    --use-hostname                        Use node hostname for cluster creation, use either --use-hostname or --use-hostname=true to change
	-u, --user string                         Ssh username for the node


Global Flags:
	    --log-dir string   path to save logs
	    --no-prompt        disable all user prompts
	    --verbose          print verbose logs
```

{% endtab %}
{% endtabs %}

## Command Example

The bootstrap command requires a cluster name to complete successfully. During the bootstrap process the CLI will prompt the user asking if the node should be set up as a Master node, in most circumstances answer yes

{% tabs %}
{% tab title="Bash" %}

```bash
#pf9ctl bootstrap trial --pmk-version 1.21.3-pmk.111
✓ Loaded Config Successfully
✓ Node is not onboarded and not attached to any cluster
✓ Removal of existing CLI
✓ Existing Platform9 Packages Check
✓ Required OS Packages Check
✓ SudoCheck
✓ CPUCheck
✓ DiskCheck
✓ MemoryCheck - At least 12 GB of memory is needed on host. Total memory found: 4 GB
✓ PortCheck
✓ Existing Kubernetes Cluster Check
✓ Check lock on dpkg
✓ Check lock on apt
✓ Check if system is booted with systemd
✓ Check time synchronization
✓ Check if firewalld service is not running
✓ Disabling swap and removing swap in fstab
✓ Completed Pre-Requisite Checks successfully

Optional pre-requisite check(s) failed. See /home/ubuntu/pf9/log/pf9ctl-20211119.log or use --verbose for logs 
Prep local node as master node for kubernetes cluster (y/n): y
✓ Platform9 packages installed successfully
✓ Initialised host successfully
✓ Host successfully attached to the Platform9 control-plane
✓ Cluster creation started
✓ Host is connected
✓ Attached node to the cluster
✓ Bootstrap successfully finished

Cluster creation started....This may take a few minutes....Check the latest status in UI
✓ Host is connected
| Attaching node to the cluster trial
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.platform9.com/managed-kubernetes/5.7/pmk-cli-commands/cli-bootstrap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
