- A Locally running kubernetes cluster(MiniKube) or Running kubernetes cluster in your environment
- Basis kubernetes tools like kubectl (to interact with kubernetes cluster), helm(for deployment)
- A Terminal to run all the commands
- Access service endpoint through any browser
-
To install kubernetes with MiniKube
-
To Install Kubectl
-
To install Helm(Package Manager) & Tiller(Helm Server) for kubernetes cluster
Important Note:
-
Please configure kubectl command to interact with correct kubernetes cluster using kubernetes-context
-
Get Current Context using below command
kubectl config get-contexts
Example Output:
$ kubectl config get-contexts
CURRENT NAME CLUSTER AUTHINFO NAMESPACE
* docker-for-desktop docker-for-desktop-cluster docker-for-desktop
Clone this repository and follow anyone of the methods for deployment as listed below
-
To deploy helloworld-python application using public image from garoradevops dockerhub
$ cd hello-world-k8s-python $ sh helloworld_kubernetes.sh -a
-
To Build your own Image and Push to your own container repository and deploy helloworld-python application on kubernetes
$ cd hello-world-k8s-python $ sh helloworld_kubernetes.sh -r "docker-repository-name" -i "image-name" -t "tag-name" -u "login-username" -p -e Please Enter repository login password: Note: Enter here your docker repository login password
If you are using container registry rather then dockerhub then you need to create secrets using below command kubectl create secret docker-registry regcred --docker-server=<registery name> --docker-username=<username> --docker-password=<password> --docker-email=<email-address> -n <namespace> And add this block in your deployment.yaml in helm chart. imagePullSecrets: - name: regcred
$ sh cleanup_helloworld.sh
$ kubectl create serviceaccount tiller -n kube-system
$ kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
$ helm init --service-account tiller --upgrade
$ kubectl create ns helloworld-python
$ cd hello-world-k8s-python
$ helm upgrade --install helloworld-python helloworld-python/ --namespace helloworld-python
helloworld-pyhton
: helm chart for helloworld-python application.Dockerfile
: Dockerfile to build your own imagehello_world.py
: python hello world programme.cleanup_helloworld.sh
: script to delete helloworld-python helm chart and helloworld-python namespace from kubernetes.helloworld_kubernetes.sh
: Shell script for automate deployment of helloworld-python application.