Giter VIP home page Giter VIP logo

docker-and-kubernetes-on-both-master-and-slave-machines's Introduction

Commands for setting up Docker and Kubernetes on both Master and Slave machines, along with some additional commands for deploying and managing Kubernetes resources. If you want to create a GitHub README file, you can format the provided information for better readability. Here's a simple template that you can use for your README file:

# Kubernetes Installation and Configuration Guide

This guide provides step-by-step instructions for setting up Docker and Kubernetes on both Master and Slave machines. Additionally, it includes commands for deploying custom pods and managing Kubernetes resources.

## Prerequisites

- Ubuntu-based operating system
- Internet connection

## Docker Installation

```bash
# Common for both Master and Slave Machine
sudo apt-get update && apt-get install -y curl apt-transport-https
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install containerd.io docker-ce

Kubernetes Installation

# Common for both Master and Slave Machine
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" >/etc/apt/sources.list.d/kubernetes.list
apt-get update
apt -y install kubeadm kubectl kubelet

# Open Below file and then comment disabled_plugin for CRI Runtime
vi /etc/containerd/config.toml    # Add # in front of disabled_plugin in this file and save it
service containerd restart

Kubernetes Master Node Configuration

# Limited to Master Node
kubeadm init
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
kubeadm token create --print-join-command
kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml

Deploying Custom Pods

# Using Below Commands to Deploy Custom PODS
kubectl get node
kubectl get pods --all-namespaces
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl taint nodes --all node-role.kubernetes.io/control-plane-
kubectl get pods --all-namespaces

kubectl create deployment kubernetes-bootcamp --image=docker.io/jocatalin/kubernetes-bootcamp:v1 --port=8080
kubectl get deployments
kubectl get pods
kubectl describe pod kubernetes-bootcamp-7dc9765bf6-gbkjw
kubectl exec -ti $POD_NAME curl localhost:8080

kubectl get services

kubectl expose deployment/kubernetes-bootcamp --port=8080 --target-port=8080 --type=NodePort

kubectl describe services kubernetes-bootcamp

kubectl scale deployments/kubernetes-bootcamp --replicas=2

kubectl get pods -o wide

kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2

kubectl rollout status deployments/kubernetes-bootcamp

kubectl rollout undo deployments/kubernetes-bootcamp

For more details and updates, refer to InstallationGuides/Kubernetes.txt.


Copy and paste this template into your GitHub README file. Make sure to replace any placeholders with actual information if needed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.