88 lines
2.5 KiB
Plaintext
88 lines
2.5 KiB
Plaintext
mkdir ~/k3d
|
|
|
|
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
|
|
CLUSTER=cnbc
|
|
IP4=$(/sbin/ip -o -4 addr list br2 | awk '{print $4}' | cut -d/ -f1)
|
|
|
|
# Get from TRAINER :)
|
|
MIRROR_IP=192.168.1.246
|
|
cat >registries.yml <<EOF
|
|
mirrors:
|
|
docker.io:
|
|
endpoint:
|
|
- "http://$MIRROR_IP:5001"
|
|
- "https://mirror.gcr.io"
|
|
- "https://docker.io"
|
|
EOF
|
|
|
|
# WARNING Check IP
|
|
k3d cluster create $CLUSTER \
|
|
--api-port 8545 \
|
|
-p "8580:80@loadbalancer" \
|
|
-p "8543:443@loadbalancer" \
|
|
--agents=2 \
|
|
--k3s-arg "--tls-san=$IP4@server:0" \
|
|
--k3s-arg "--disable=traefik@server:0" \
|
|
--registry-create $CLUSTER-registry:0.0.0.0:5000 \
|
|
--registry-config=./registries.yml
|
|
echo | \
|
|
openssl s_client -connect $IP4:8545 2>/dev/null | \
|
|
openssl x509 -text
|
|
|
|
PORT=$(docker container inspect \
|
|
--format '{{ (index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort }}' \
|
|
$CLUSTER-registry)
|
|
sudo sh -c "echo 127.0.0.1 $CLUSTER-registry >>/etc/hosts"
|
|
curl cnbc-registry:5000/v2/_catalog
|
|
source <(k3d completion bash)
|
|
|
|
cloud:
|
|
|
|
curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | bash
|
|
CLUSTER=cnbc
|
|
# cloud instance
|
|
IP4=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
|
|
|
|
# WARNING Check IP
|
|
k3d cluster create $CLUSTER \
|
|
--api-port 8545 \
|
|
-p "8580:80@loadbalancer" \
|
|
-p "8543:443@loadbalancer" \
|
|
--agents=2 \
|
|
--k3s-arg "--tls-san=$IP4@server:0" \
|
|
--k3s-arg "--disable=traefik@server:0" \
|
|
--registry-create $CLUSTER-registry:0.0.0.0:5000
|
|
|
|
echo | \
|
|
openssl s_client -connect $IP4:8545 2>/dev/null | \
|
|
openssl x509 -text
|
|
|
|
PORT=$(docker container inspect \
|
|
--format '{{ (index (index .NetworkSettings.Ports "5000/tcp") 0).HostPort }}' \
|
|
$CLUSTER-registry)
|
|
sudo sh -c "echo 127.0.0.1 $CLUSTER-registry >>/etc/hosts"
|
|
curl cnbc-registry:5000/v2/_catalog
|
|
source <(k3d completion bash)
|
|
|
|
sudo apt-get update && sudo apt-get install -y apt-transport-https
|
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg \
|
|
| sudo apt-key add -
|
|
echo "deb https://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 kubectl
|
|
|
|
source <(kubectl completion bash)
|
|
source <(k3d completion bash)
|
|
|
|
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
|
|
chmod 700 get_helm.sh
|
|
./get_helm.sh
|
|
source <(helm completion bash)
|
|
|
|
|
|
default Namespace nächste commands
|
|
|
|
kubectl config set-context --current --namespace whoami |