Using minikube makes it easy to install a single server Kubernetes cluster for local testing/development.
- https://github.com/kubernetes/minikube
- https://kubernetes.io/docs/user-guide/prereqs/
- https://kubernetes.io/docs/tutorials/
- https://kubernetes.io/docs/user-guide/deployments/
- https://kubernetes.io/docs/user-guide/services/
- https://kubernetes.io/docs/user-guide/docker-cli-to-kubectl/
Ref: https://kubernetes.io/docs/user-guide/prereqs/
Switch to bash if necessary.
$ bash
Download and install the latest stable release.
$ curl -#LO https://storage.googleapis.com/kubernetes-release/release/$(
curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt
)/bin/darwin/amd64/kubectl \
&& install kubectl /usr/local/bin/kubectl
$ curl -#Lo minikube \
https://storage.googleapis.com/minikube/releases/v0.17.1/minikube-darwin-amd64 \
&& install minikube /usr/local/bin/minikube
$ minikube config set vm-driver virtualbox
This step is optional. Skip this if intending to use the virtualbox
vm driver.
$ brew install docker-machine-driver-xhyve
Note: This will take some time
$ minikube start
OR, if using xhyve.
$ minikube start --vm-driver=xhyve
$ minikube ip
OR
$ kubectl cluster-info
$ minikube dashboard
Note: Will take some time pulling images.
$ kubectl create -f php-hello-world.yml --record
$ kubectl delete -f php-hello-world.yml
$ kubectl create -f php-hello-world.svc.yml
$ kubectl get deployment php-hello-world
$ kubectl scale --current-replicas=1 --replicas=3 deployment/php-hello-world
$ kubectl get pods --show-labels
$ kubectl rollout status deployment/php-hello-world
$ minikube service php-hello-world --url
$ kubectl exec -it {pod-name} bash
Ref: https://kubernetes.io/docs/user-guide/deployments/#updating-a-deployment
To update the image named php-hello-world
to use the tag jdeathe/centos-ssh-apache-php:2.1.1
.
$ kubectl set image deployment/php-hello-world php-hello-world=jdeathe/centos-ssh-apache-php:2.1.1
Alternatively, edit the deployment to be applied on save.
$ kubectl edit deployment/php-hello-world