github.com/caos/orbos@v1.5.14-0.20221103111702-e6cd0cea7ad4/docs/orbiter/static.md (about)

     1  # Using the StaticProvider
     2  
     3  In the following example we will create a `kubernetes` cluster on a `StaticProvider`. A `StaticProvider` is a provider, which has no or little API for automation, e.g legacy VM's or Bare Metal scenarios. For demonstration purposes, we use KVM to provision VM's here.
     4  
     5  ## Create Two Virtual Machines
     6  
     7  Install KVM according to the [docs](https://wiki.debian.org/KVM)
     8  
     9  Create a new SSH key pair
    10  
    11  ```bash
    12  mkdir -p ~/.ssh && ssh-keygen -t rsa -b 4096 -C "VM bootstrap key" -P "" -f ~/.ssh/myorb_bootstrap -q
    13  ```
    14  
    15  Create and setup two new Virtual Machines. Make sure you have a sudo user called orbiter on the guest OS
    16  
    17  ```bash
    18  ./examples/orbiter/static/kvm/machine.sh ./examples/orbiter/static/kvm/kickstart.cfg ~/.ssh/myorb_bootstrap.pub master1
    19  ./examples/orbiter/static/kvm/machine.sh ./examples/orbiter/static/kvm/kickstart.cfg ~/.ssh/myorb_bootstrap.pub worker1
    20  ```
    21  
    22  ### Create a new repository on Github.com
    23  
    24  Copy the files [orbiter.yml](examples/orbiter/gce/orbiter.yml) and [boom.yml](examples/boom/boom.yml) to the root of your new git Repository
    25  
    26  ### Configure your environment
    27  ```bash
    28  # Install the latest orbctl
    29  curl -s https://api.github.com/repos/caos/orbos/releases/latest | grep "browser_download_url.*orbctl-$(uname)-$(uname -m)" | cut -d '"' -f 4 | sudo wget -i - -O /usr/local/bin/orbctl
    30  sudo chmod +x /usr/local/bin/orbctl
    31  sudo chown $(id -u):$(id -g) /usr/local/bin/orbctl
    32  
    33  # Create an orb file at ${HOME}/.orb/config
    34  orbctl configure --repourl 'git@github.com:me/my-orb.git' --masterkey "$(openssl rand -base64 21)"
    35  
    36  # Add your bootstrap key pair to the remote orbiter.yml
    37  orbctl writesecret orbiter.kvm.bootstrapkeyprivate --file ~/.ssh/myorb_bootstrap
    38  orbctl writesecret orbiter.kvm.bootstrapkeypublic --file ~/.ssh/myorb_bootstrap.pub
    39  
    40  # Note your machine names and IP addresses
    41  for VM in $(virsh list --all --name); do echo $VM; virsh domifaddr $VM; done
    42  
    43  # Update the pools section according to the output of the following command and push your changes to the remote repository
    44  orbctl edit orbiter.yml
    45  ```
    46  
    47  ## Bootstrap your local Kubernetes cluster
    48  
    49  ```bash
    50  orbctl takeoff
    51  ```
    52  
    53  As soon as the Orbiter has deployed itself to the cluster, you can decrypt the generated admin kubeconfig
    54  
    55  ```bash
    56  mkdir -p ~/.kube
    57  orbctl readsecret orbiter.k8s.kubeconfig > ~/.kube/config
    58  ```
    59  
    60  Wait for grafana to become running
    61  
    62  ```bash
    63  kubectl --namespace caos-system get po -w
    64  ```
    65  
    66  Open your browser at localhost:8080 to show your new clusters dashboards
    67  
    68  ```bash
    69  kubectl --namespace caos-system port-forward svc/grafana 8080:80
    70  ```
    71  
    72  Cleanup your environment
    73  
    74  ```bash
    75  for MACHINE in master1 worker1
    76  do
    77      virsh destroy $MACHINE
    78      virsh undefine $MACHINE
    79  done
    80  ```