- Run
get-kind.sh [-i <kind version>] [-n <kindest/node version>]- Download specified version of
kindand latest version ofkubectl. - Then, copy them as
kind-[version]andkubectl-[latest version]intotoolsdirectory. - Also, create symbolic links
kindfor specified version ofkindandkubectlforkubectl-[latest version]intotoolsdirectory. - Furthermore, create config file for
kindwith specified version ofkindest/nodeimage, i.e. kubernetes version, as./tmp/kind.yaml.
- Download specified version of
- Options:
- Specify
kindversion andkindest/nodeversion with hash from release site for kind - kind version
- Default:
v0.11.0
- Default:
- kindest/node version
- Default:
kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- Default:
- Specify
- Clone
kindsource code withgit clone https://github.com/kubernetes-sigs/kind. - Change code and commit them into your specified branch.
- Run
build-kind.sh [-s <source code directory>] [-b <branch>] [-n <kindest/node version>]- Build
kindfrom source code. - Then, copy it as
kind-[branch]intotoolsdirectory. - Also, create symbolic link
kindforkind-[branch]intotoolsdirectory.
- Build
- Options
- branch
- Default:
master
- Default:
- kind source directory
- Default:
${GOPATH}/src/github.com/kubernetes-sigs/kind
- Default:
- kindest/node version
- Specify applicable version of
kindest/nodefor yourkindbranch with hash from release site for kind. - Default:
kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
- Specify applicable version of
- branch
NOTE: Kubernetes v1.21.0 or later needs docker buildx to build. And docker buildx needs docker ce v19.03 or later. In ubuntu 20.04, the version of docker is v19.03.x but not enabled buildx. If so, setup buildx as followings.
mkdir -p ${HOME}/.docker/cli-plugins
wget -nc -O ${HOME}/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.5.1/buildx-v0.5.1.linux-amd64`
chmod +x ${HOME}/.docker/cli-plugins/docker-buildx
Also, create ${HOME}/.docker/config.json add {"experimental": "enabled"} into it.
- Clone
kubernetessource code withgit clone https://github.com/kubernetes/kubernetes. - Change code and commit them into your specified branch.
- Run
build-node-image.sh [-s <source code directory>] [-b <branch>]- Build all of
kubernetescomponents from kubernetes source code. - Then, build kubernetes container image for
kindnode askindest/node:[branch]into local docker host. - Also, copy built
kubectltokubectl-[branch]intoolsdirectory. - Furthermore, create symbolic link
kubectlforkubectl-[branch]intotoolsdirectory.
- Build all of
- Options
- branch
- Default:
master
- Default:
- kubernetes source directory
- Default:
${GOPATH}/src/github.com/kubernetes/kubernetes
- Default:
- branch
- Run
./run-kind.sh [-c <kind config file>] [-x]- Create
kubernetescluster with specified version ofkindandkindest/node. - Also, create
./kubectl.shas alias of symbolic linkkubectlthat run withkubeconfigfor created cluster.
- Create
- Options:
- kind config
- Config for kind cluster.
- Default:
./tmp/kind.yaml
- x
- Ignore deploying Kubernetes Dashboard
- Default: deploying Kubernetes Dashboard
- kind config
- Deploy nginx
Confirm with following:
./kubectl.sh create deployment nginx --image=nginx:1.15 --port=80./kubectl.sh get deploy,pod - Expose nginx
Add
./kubectl.sh expose deployment nginx --type=NodePort --port=80 -oyaml --dry-run=client > tmp/nginx.svc.yamlnodePort: 30001underportsintmp/nginx.svc.yaml, then run following:Confirm with following:./kubectl.sh apply -f tmp/nginx.svc.yaml./kubectl.sh get svc -owide - Access nginx with browser
http://localhost:30001 - Create PersistentVolume and PersistentVolumeClaim.
Confirm with following:
mkdir -p volume/nginx ./kubectl.sh apply -f example/pv.yaml ./kubectl.sh apply -f example/pvc.yaml./kubectl.sh get pv,pvc - Use PersistentVolumeClaim for web root directory in nginx deployment.
Add followings:
./kubectl.sh get deployment nginx -oyaml > tmp/nginx.deploy.yamlThen run following:..... spec: ..... template: ..... spec: ..... containers: ..... volumeMounts: - mountPath: "/usr/share/nginx/html" name: nginx-volume volumes: - name: nginx-volume persistentVolumeClaim: claimName: nginx-pvc .....Confirm with following:./kubectl.sh apply -f tmp/nginx.deploy.yaml./kubectl.sh get pv,pvc,pod - Add
volume/nginx/index.html.Then confirmecho "Hello!" > volume/nginx/index.htmlhttp://localhost:30001via browser.
- Scheduling pods for Ingress controller.
Confirm current labels attached in nodes.
Set label into control-plane node for Ingress controller.
./kubectl.sh get nodes --show-labelsNote:./kubectl.sh label nodes kind-cluster-control-plane ingress-ready='true'ingress-ready='true'is used in the following manifest foringress-nginx-controller. The pod for Ingress controller will be scheduled by this label. Confirm labels added in control-plane nodes../kubectl.sh get nodes kind-cluster-control-plane --show-labels - Install Ingress NGINX Controller
And add
wget -nc -O tmp/ingress-nginx-controller.yaml https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/kind/deploy.yamlnodePort: 30080andnodePort: 30443intoingress-nginx-controllerService. Then install it:./kubectl.sh apply -f tmp/ingress-nginx-controller.yaml - Create Ingress for nginx Service via nginx-ingress-controller and modify nginx Service.
See
example/nginx-ingress.yaml, createtest/directory for Ingressnginx-ingress, and createindex.htmlfile into it.Then run following:mkdir -p volume/nginx/test echo "Here is /test/ via Ingress" > volume/nginx/test/index.html./kubectl.sh apply -f example/nginx-ingress.yaml - Access nginx
http://localhost:30080/test/via Ingress.
TBD
- Rollout deployment
- Update image
- History
- Restart
- Undo