zwischenstand
This commit is contained in:
76
k8s/install_k3d
Normal file
76
k8s/install_k3d
Normal file
@@ -0,0 +1,76 @@
|
||||
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)
|
||||
5
k8s/k8s_Object_Structure
Normal file
5
k8s/k8s_Object_Structure
Normal file
@@ -0,0 +1,5 @@
|
||||
API Version ---> die Verison
|
||||
Kind ---> Pod, Deployment, Quota, usw
|
||||
Metadaten ---> Namen, Namespache, usw
|
||||
Spec --->Desired state
|
||||
Status ---> Actual state
|
||||
16
k8s/pods
Normal file
16
k8s/pods
Normal file
@@ -0,0 +1,16 @@
|
||||
kubectl create namespace whoami
|
||||
kubectl config view
|
||||
kubectl config set-context --current --namespace whoami
|
||||
# create pod and service
|
||||
kubectl run whoami --image bee42/whoami:2.2.0 --expose --port 80
|
||||
kubectl get pods
|
||||
kubectl get pods -o yaml
|
||||
# see we created also a service!
|
||||
kubectl get svc
|
||||
|
||||
|
||||
kubectl run whoami --image bee42/whoami:2.2.0 --expose --port 80
|
||||
kubectl get pod whoami -o yaml
|
||||
|
||||
# kann zur erstellung der YAML genutzt werden.
|
||||
kubectl run whoami2 --image bee42/whoami:2.2.0 --labels=run=whoami --dry-run=client -o yaml >whoami-pod.yaml
|
||||
Reference in New Issue
Block a user