2023年9月20日星期三

windows/linux SHA256

REM: windows: CertUtil -hashfile testfile.zip SHA256

#linux sha256sum testfile.zip

2023年9月18日星期一

minikube basic

Reference: https://minikube.sigs.k8s.io/docs/handbook/controls/

 Start a cluster by running:

minikube start

Access the Kubernetes dashboard running within the minikube cluster:

minikube dashboard

Once started, you can interact with your cluster using kubectl, just like any other Kubernetes cluster. For instance, starting a server:

# create deployment
kubectl create deployment regex-minikube --image=registry.dev.mbpsmartec.co.jp/regexgo:v4
# expose a service as a NodePort
kubectl expose deployment regex-minikube --type=NodePort --port=8080

minikube makes it easy to open this exposed endpoint in your browser:

minikube service regex-minikube

Upgrade your cluster:

minikube start --kubernetes-version=latest

Start a second local cluster
(note: This will not work if minikube is using the bare-metal/none driver):

minikube start -p cluster2

Deploying apps

kubectl create deployment hello-minikube1 --image=kicbase/echo-server:1.0 kubectl expose deployment hello-minikube1 --type=LoadBalancer --port=8080
kubectl expose deployment hello-minikube1 --type=NodePort --port=8080

$ kubectl get svc
NAME              TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
hello-minikube1   NodePort    10.100.238.34   <none>        8080:31389/TCP   3s

$ minikube service hello-minikube1 --url

Addons (Istio or Ingress) 
built-in list of applications and services minikube addons list
minikube addons enable <name> #enable an addon at start-up, where –addons option can be specified multiple times:
minikube start --addons <name1> --addons <name2>

Stop your local cluster:

minikube stop

Delete your local cluster:

minikube delete
#Delete all local clusters and profiles
minikube delete --all

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