2023年9月17日星期日

kind(kube in docker) instroduction

Linux:
______________________________________
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
#check install 
kubectl version --client

curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.10.0/kind-linux-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin/
#check install 
kind version
__________________________________________

kind create cluster --name=kind2 --config=kind-config.yaml
-------------------------kind-config.yaml: 
# this config file contains all config fields with comments
# NOTE: this is not a particularly useful config file
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
# patch the generated kubeadm config with some extra settings
kubeadmConfigPatches:
- |
  apiVersion: kubelet.config.k8s.io/v1beta1
  kind: KubeletConfiguration
  evictionHard:
    nodefs.available: "0%"
# patch it further using a JSON 6902 patch
kubeadmConfigPatchesJSON6902:
- group: kubeadm.k8s.io
  version: v1beta2
  kind: ClusterConfiguration
  patch: |
    - op: add
      path: /apiServer/certSANs/-
      value: my-hostname
# 1 control plane node and 3 workers
nodes:
# the control plane node config. default one node hosting a control plane
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "my-label=true"
  extraMounts:
  - hostPath: /home/test-user/data/files/
    containerPath: /files
  extraPortMappings:
  - containerPort: 80
    hostPort: 8000
    listenAddress: "0.0.0.0" # Optional, defaults to "0.0.0.0"
    #protocol: udp # Optional, defaults to tcp
# the three workers
- role: worker
- role: worker
- role: worker

没有评论: