Folgende Tools werden lokal benötigt:

  • kubectl
  • kind und docker
  • helm

Cluster erstellen

kind create cluster
clusterctl init --infrastructure vsphere
clusterctl config cluster k8s-dev --kubernetes-version=v1.20.1 --control-plane-machine-count=3 --worker-machine-count=3 > deploy_dev.yaml
kubectl apply -f deploy_dev.yaml
kubectl get kubeadmcontrolplane --all-namespaces
clusterctl get kubeconfig k8s-dev > k8s-dev.kubeconfig
export KUBECONFIG=k8s-dev.kubeconfig

docker login
kubectl create secret generic regcred --from-file=.dockerconfigjson=/home/xforze/.docker/config.json --type=kubernetes.io/dockerconfigjson
kubectl create secret -n kube-system generic regcred --from-file=.dockerconfigjson=/home/xforze/.docker/config.json --type=kubernetes.io/dockerconfigjson
kubectl create secret -n tigera-operator generic tigera-pull-secret --from-file=.dockerconfigjson=/home/xforze/.docker/config.json --type=kubernetes.io/dockerconfigjson

# Install Weavenet
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"


# Install Calico
kubectl create -f https://docs.projectcalico.org/archive/v3.18/manifests/tigera-operator.yaml
kubectl create -f https://docs.projectcalico.org/archive/v3.18/manifests/custom-resources.yaml
</pre>

Add insecure Flag to vsphere-csi-driver

kubectl edit secret -n kube-system csi-vsphere-config
[Global]
insecure-flag = "true"

Add a Storageclass:

kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: example-vanilla-block-sc
  annotations:
    storageclass.kubernetes.io/is-default-class: "true"  # Optional
provisioner: csi.vsphere.vmware.com
allowVolumeExpansion: true  # Optional: only applicable to vSphere 7.0U1 and above
parameters:
  datastoreurl: "ds:///vmfs/volumes/vsan:52cdfa80721ff516-ea1e993113acfc77/"  # Optional Parameter
  storagepolicyname: "vSAN Default Storage Policy"  # Optional Parameter
  csi.storage.k8s.io/fstype: "ext4"  # Optional Parameter

Add en example pvc:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: example-vanilla-block-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 5Gi
  storageClassName: example-vanilla-block-sc

Schreibe einen Kommentar