Skip to content

Instantly share code, notes, and snippets.

@cloudnull
Last active November 24, 2023 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cloudnull/eb2f0fc0602efc3f33af417c65d8fe07 to your computer and use it in GitHub Desktop.
Save cloudnull/eb2f0fc0602efc3f33af417c65d8fe07 to your computer and use it in GitHub Desktop.
RKE1 OpenStack
alias os='openstack --os-cloud rxt-mvp '
os network create osh1
os subnet create \
osh1-subnet \
--network osh1 \
--subnet-range 172.31.0.0/28 \
--dns-nameserver 8.8.8.8
os router create \
osh1-router
os router add subnet \
osh1-router \
osh1-subnet
os router set --external-gateway \
$(os network list --external -f value -c ID) \
osh1-router
os security group create osh1
os security group rule create --protocol icmp --dst-port 1:65535 osh1
os security group rule create --protocol tcp --dst-port 22:22 osh1
os security group rule create --protocol tcp --dst-port 53:53 osh1
os security group rule create --protocol tcp --dst-port 179:179 osh1
os security group rule create --protocol tcp --dst-port 6443:6443 osh1
os security group rule create --protocol tcp --dst-port 2380:2380 osh1
os security group rule create --protocol tcp --dst-port 7080:7080 osh1
os security group rule create --protocol tcp --dst-port 8472:8472 osh1
os security group rule create --protocol tcp --dst-port 8080:8080 osh1
os security group rule create --protocol tcp --dst-port 8001:8001 osh1
os security group rule create --protocol tcp --dst-port 9100:9100 osh1
os security group rule create --protocol tcp --dst-port 443:443 osh1
os security group rule create --protocol tcp --dst-port 10250:10250 osh1
os security group rule create --protocol udp --dst-port 8472:8472 osh1
os security group rule create --protocol tcp --dst-port 30000:32767 osh1
os security group rule create --protocol tcp --dst-port 2379:2379 osh1
ssh-keygen -t ed25519 -N '' -f /root/.ssh/id_osh1
os keypair create --public-key /root/.ssh/id_osh1.pub osh1-key
os server create \
--flavor r2.compute.gen0 \
--image="296f9ba6-6a27-4b1c-be44-484958c5b46b" \
--network osh1 \
--key-name osh1-key \
--security-group osh1 \
--user-data ./install_docker.sh \
--max 3 \
osh-cluster
os server create \
--flavor r1.compute.gen0 \
--image="296f9ba6-6a27-4b1c-be44-484958c5b46b" \
--network osh1 \
--key-name osh1-key \
--security-group osh1 \
osh-launcher
FLOATING_IP=$(os floating ip create --description "OSH1 Cluster - Deployment Node" $(os network list --external -f value -c ID) -f value -c floating_ip_address)
os server add floating ip osh-launcher $FLOATING_IP
scp -i ~/.ssh/id_osh1 ~/.ssh/id_osh1 ubuntu@$FLOATING_IP:/home/ubuntu/.ssh/id_rsa
ssh -i ~/.ssh/id_osh1 ubuntu@$FLOATING_IP
curl -OL https://github.com/rancher/rke/releases/download/v1.4.11/rke_linux-amd64
chmod +x rke_linux-amd64
sudo mv rke_linux-amd64 /usr/local/bin/rke
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
``` yaml
nodes:
- address: 172.31.0.8
user: ubuntu
role:
- controlplane
- worker
- etcd
- address: 172.31.0.9
user: ubuntu
role:
- controlplane
- worker
- etcd
- address: 172.31.0.5
user: ubuntu
role:
- controlplane
- worker
- etcd
services:
etcd:
snapshot: true
creation: 6h
retention: 24h
ingress:
provider: nginx
options:
use-forwarded-headers: "true"
```
mkdir ~/.kube
cp kube_config_rancher-cluster.yml ~/.kube/config
# Create the dashboard
VER=$(curl -s https://api.github.com/repos/kubernetes/dashboard/releases/latest|grep tag_name|cut -d '"' -f 4)
wget https://raw.githubusercontent.com/kubernetes/dashboard/$VER/aio/deploy/recommended.yaml -O kubernetes-dashboard.yaml
kubectl apply -f kubernetes-dashboard.yaml
# Install helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment