# Kubernetes in a Month

## Syllabus

## objective : Launch Rancher locally via Docker, access it's UI  and setup the admin user to begin cluster management

## Day 1 - Prerequisites and initial setup

Daily tasks :tada: :&#x20;

* Installed Docker
* Install Minikube
* Install Kubectl&#x20;
* Install Helm

```
# Docker installation
sudo apt update && sudo apt install -y docker.io
# check docker version
docker version
# Add user to the group
sudo usermod -aG docker $USER && newgrp docker

# kubectl installation 
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && sudo install kubectl /usr/local/bin/
# version check
kubectl version --client

```

To run rancher container

`docker run -d --restart=unless-stopped -p 80:80 -p 443:443 --name rancher rancher/rancher:latest`

```
-d: Runs in detached mode (background).
--restart=unless-stopped: Restarts unless manually stopped, mimicking prod resilience.
-p 80:80 -p 443:443: Maps HTTP and HTTPS ports to your host.
--name rancher: Names the container for easy reference.
rancher/rancher:latest: Pulls the latest stable Rancher image.                             
```

<figure><img src="/files/My5tkbUKN8RjYQhmLWFh" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/WucD29Eyz3TRNmQ9Ej2Y" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/9YVFfYSpoce0dxMh4xqT" alt=""><figcaption></figcaption></figure>

### Day-2 Deploy RKE Cluster

Objective : Use Rancher UI to create a single-node RKE cluster on your local Minikube environment, verify its status, and prepare it for ShopSphere deployments

1. Start minikube(Base for RKE) `minikube start --driver=docker --nodes 1 --memory 4096 --cpus 4`&#x20;
2. check status `minikube status`

<figure><img src="/files/658sIgNBQCPlMEFbywTX" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/C5GvwJP1P4gF99s6dPlq" alt=""><figcaption></figcaption></figure>

3. Access Rancher Ui and Create RKE Cluster

cluster management -->  create --> custom and Give name to the cluster of your choice `shopshere-cluster`  let's leave other settings default and then do the node configuration as like below👇

<figure><img src="/files/QJ81DGHwKSojefDamw1Q" alt=""><figcaption></figcaption></figure>

4. Run Rancher agent on minikube host. In your terminal copy paste the command that you copied on rancher UI.&#x20;

<figure><img src="/files/iiuhR3weoa2flko0BWIK" alt=""><figcaption></figcaption></figure>

```
--privileged: Grants necessary permissions for Kubernetes components.
-v /var/run/docker.sock: Allows the agent to manage Docker on your host.
--etcd --controlplane --worker: Configures all roles on this node
```

Verify Agent is running

<figure><img src="/files/Y3iPTp9ympUquluBVIVu" alt=""><figcaption></figcaption></figure>

5. Monitor cluster creation in Rancher UI

6. Download kubeconfig and test cluster&#x20;

<figure><img src="/files/j4WrfQc4G6EErNzsuEn3" alt=""><figcaption></figcaption></figure>

* Get kubeconfig file of the cluster by clicking on : at the end of the cluster and copy it in your terminal. update minikube and check the cluster status by running `kubectl cluster-info` &#x20;

### Day 3  Deploy Product Service with Helm

Objective : Containerize the product service, create a helm chart, and deploy it to your shopshere-cluster via Rancher, ensuring it is running and accessible locally

**Pre-requisites :**&#x20;

* Rancher is running `docker ps | grep rancher`&#x20;
* RKE cluster (shopshere-cluster) is active in rancher dashboard : Check rancher ui or kubectl get nodes
* Docker hub account is setup for pushing images
* Helm is installed
* Updated jira dashboard

<figure><img src="/files/xocXoZqdaNFfm9JE1dxP" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://charan-techjourney.gitbook.io/charan-techjournal/50-days-of-devops-ecommerce-microservices/weekly-devops/kubernetes-in-a-month.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
