Posts

Installing Kubernetes on Bare Metal Server or Virtual machine via kubeadm

Kubernetes is docker orchestration tool developed by google. For Installing kubernetes we required 4 packages  to be installed on machine. Install Docker for Ubuntu: $ apt-get update $ apt-get install -y docker.io Install Docker for CentOS/RHEL: $ yum install -y docker $ systemctl enable docker && systemctl start docker Install kubeadm, kubelet and kubectl. kubeadm: The command to bootstrap the cluster. kubelet: The component that runs on all of the machines in your cluster and does things like starting pods and containers. kubectl: The command line util to talk to your cluster. Install  kubelet kubeadm kubectl kubernetes-cni   for Ubuntu: $ apt-get update && apt-get install -y apt-transport-https $ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - $ cat <<EOF >/etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main EOF $ apt-get update ...

Best Practices for Kubernetes

Kubernetes is an open-source system for automating deployment, scaling, and management of containerized applications.  Lets see some of the best practices of Kubernetes, Containers:-  Containers should be ephemeral. Use a .dockerignore file. Use multi-stage builds. Avoid installing unnecessary packages. Each container should have only one concern. Minimize the number of layers. Sort multi-line arguments. Build cache. Don’t trust arbitrary base images. Use small base image. Use the builder pattern. Inside Container:- Use non-root user inside container. Make the file system read only. One process per container. Don't restart on failure, crash cleanly instead. Log to stdout & stdderr Add dumb-init to prevent zombie processes. Deployment:- Use the "record" option for easier rollbacks. Use plenty of descriptive labels. Use sidecar containers for proxies , watchers etc. Don't use sidecar for bootstrapp...