---
# System prepended metadata

title: Local Minikube Swarm K8S Guide

---

# Local Minikube Swarm K8S Guide

# Docker
https://docs.docker.com/install/linux/docker-ce/ubuntu/
`sudo apt-get update`
```
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
```
`curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add `

`sudo apt-key fingerprint 0EBFCD88`

```
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
```

`sudo apt-get update`

`sudo apt-get install docker-ce docker-ce-cli containerd.io`

# Minikube
`curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64   && chmod +x minikube`

`sudo install minikube /usr/local/bin`

```sudo minikube start --vm-driver=none --apiserver-ips 127.0.0.1 --apiserver-name localhost --extra-config=apiserver.runtime-config=apps/v1beta1=true,apps/v1beta2=true,extensions/v1beta1/daemonsets=true,extensions/v1beta1/deployments=true,extensions/v1beta1/replicasets=true,extensions/v1beta1/networkpolicies=true,extensions/v1beta1/podsecuritypolicies=true```

`sudo mv /root/.kube /root/.minikube $HOME`

Optional `sudo chown -R $USER $HOME/.kube $HOME/.minikube`
Optional `sudo chgrp -R $USER $HOME/.kube $HOME/.minikube`

`minikube status`

# Kubectl
 ```curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl```
 
`chmod +x ./kubectl`

`sudo mv ./kubectl /usr/local/bin/kubectl`

# Helm
`curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh`

`chmod 700 get_helm.sh`

`./get_helm.sh`

# Helm Init
This defines the namespace for Swarm resources
`export NAMESPACE=your-namespace`

`kubectl create namespace $NAMESPACE`
`kubectl -n $NAMESPACE apply -f tiller.rbac.yaml`

`kubectl get events --all-namespaces | grep -i tiller`

`helm init --service-account tiller --tiller-namespace $NAMESPACE`

`helm repo add ethersphere-charts https://raw.githubusercontent.com/ethersphere/helm-charts-artifacts/master/`

`helm repo list`

## Download helmsan
`curl -L https://github.com/Praqma/helmsman/releases/download/v1.12.0/helmsman_1.12.0_linux_amd64.tar.gz | tar zx`

`mv helmsman /usr/local/bin/helmsman`

## Download helm diff
`helm plugin install https://github.com/databus23/helm-diff --version master`

## Download Socat
`sudo apt-get install socat -y`

# Configure Swarm Deploy

https://github.com/skylenet/swarm-deploy-examples

add node labels
`kubectl label nodes minikube nospot=true app=swarm-private`

change swarm.yml and values (use the one fabio sent)
apply swarm-deploy-examples/incentives swarm.yml with helmsman

modify helmsman-swap.yaml and point to swarm-private-swap.yml

check storageclass
kubectl get storageclasses = standard

change storage class = standard

change tillerNamespace

remove smoke test

**This starts the swarm cluster**
`helmsman -f helmsman-swap.yaml --show-diff --apply`

