Skip to content

Instantly share code, notes, and snippets.

@ronaldpetty
Created December 16, 2023 03:09
Show Gist options
  • Save ronaldpetty/921441d6f78a0c69d85cc153babd0c73 to your computer and use it in GitHub Desktop.
Save ronaldpetty/921441d6f78a0c69d85cc153babd0c73 to your computer and use it in GitHub Desktop.

WARNING

t3.large (2/8) is not enough (cpu) t3.xlarge (4/16) is not enough (cpu) t3.2xlarge (8/32) trying...

# got "too many files" during kubeflow install
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl fs.inotify.max_user_instances=512

Kubernetes

https://kubernetes.io/docs/home/

~$ vi k8s.sh 
set -e

TOOLVERS=1.26.2-00

# Install Docker
wget -qO- https://get.docker.com/ | sh

sudo mkdir -p /etc/docker
cat <<EOF | sudo tee /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF
sudo systemctl restart docker

# Configure Docker's bundled containerd to enable cni & use systemd for cgroups
sudo cp /etc/containerd/config.toml /etc/containerd/config.bak
sudo containerd config default | sudo tee /etc/containerd/config.toml
sudo sed -i -e 's/SystemdCgroup = false/SystemdCgroup = true/' /etc/containerd/config.toml
sudo systemctl restart containerd

# Initialize a control plane node
curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/kubernetes-xenial.gpg
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubelet=$TOOLVERS kubectl=$TOOLVERS kubeadm=$TOOLVERS
sudo swapoff -a
if [ -z ${K8S_VERSION+x} ]; then K8S_VERSION="--kubernetes-version=stable-1"; else K8S_VERSION="--kubernetes-version=$K8S_VERSION"; fi
sudo kubeadm init --cri-socket=unix:///var/run/containerd/containerd.sock $K8S_VERSION
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s-1.11.yaml
kubectl patch node $(hostname) -p '{"spec":{"taints":[]}}'

# Install the latest crictl (cni-tools package is not always the latest)
CRICTL_VERSION=$(curl -s https://api.github.com/repos/kubernetes-sigs/cri-tools/releases/latest | grep tag_name | cut -d '"' -f 4 | cut -b 2-)
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/v$CRICTL_VERSION/crictl-v$CRICTL_VERSION-linux-amd64.tar.gz
sudo tar zxvf crictl-v$CRICTL_VERSION-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-v$CRICTL_VERSION-linux-amd64.tar.gz
echo "runtime-endpoint: unix:///run/containerd/containerd.sock" | sudo tee /etc/crictl.yaml
chmod 700 k8s.sh 
./k8s.sh

Longhorn

Required DefaultStorageProvider for Kubeflow

sudo apt install jq nfs-common -y # needed by environment_check.sh

curl -s https://raw.githubusercontent.com/longhorn/longhorn/v1.5.3/scripts/environment_check.sh | bash

kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.5.3/deploy/longhorn.yaml

Kustomize

curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash

sudo mv kustomize /usr/bin/

Kubeflow

https://www.kubeflow.org/

git clone https://github.com/kubeflow/manifests.git kubeflow/manifests

while ! kustomize build kubeflow/manifests/example | kubectl apply -f -; do echo "Retrying to apply resources"; sleep 10; done

kubectl port-forward --address=0.0.0.0 svc/istio-ingressgateway -n istio-system 8080:80

Application

http://13.59.y.z:8080/ (use login/pass above)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment