- Run
get-kind.sh [-i <kind version>] [-n <kindest/node version>]
- Download specified version of
kind
and latest version ofkubectl
. - Then, copy them as
kind-[version]
andkubectl-[latest version]
intotools
directory. - Also, create symbolic links
kind
for specified version ofkind
andkubectl
forkubectl-[latest version]
intotools
directory. - Furthermore, create config file for
kind
with specified version ofkindest/node
image, i.e. kubernetes version, as./tmp/kind.yaml
.
- Download specified version of
- Options:
- Specify
kind
version andkindest/node
version 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
kind
source 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
kind
from source code. - Then, copy it as
kind-[branch]
intotools
directory. - Also, create symbolic link
kind
forkind-[branch]
intotools
directory.
- 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/node
for yourkind
branch 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
kubernetes
source 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
kubernetes
components from kubernetes source code. - Then, build kubernetes container image for
kind
node askindest/node:[branch]
into local docker host. - Also, copy built
kubectl
tokubectl-[branch]
intools
directory. - Furthermore, create symbolic link
kubectl
forkubectl-[branch]
intotools
directory.
- 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
kubernetes
cluster with specified version ofkind
andkindest/node
. - Also, create
./kubectl.sh
as alias of symbolic linkkubectl
that run withkubeconfig
for 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.yaml
nodePort: 30001
underports
intmp/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.yaml
Then 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.html
http://localhost:30001
via 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-labels
Note:./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.yaml
nodePort: 30080
andnodePort: 30443
intoingress-nginx-controller
Service. 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.html
file 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