Changes between Version 7 and Version 8 of minikubedeployment2023


Ignore:
Timestamp:
Dec 4, 2023, 5:08:08 AM (12 months ago)
Author:
deepthi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • minikubedeployment2023

    v7 v8  
    1 You may continue to install Kubernetes on the vm you already installed docker. If you are installing this on a different machine make sure docker is already installed.
    2 
     1'''You may continue to install Kubernetes on the vm you already installed docker. If you are installing this on a different machine make sure docker is already installed.
     2'''
    33==== Part 1 ====
    44
    5 Installing kubeadm, kubelet, and kubectl:
     5'''Installing kubeadm, kubelet, and kubectl:'''
    66
    771. Update the apt package index:
     
    3939`kubeadm version`
    4040 
    41 Disable Swap Space
     41'''Disable Swap Space'''
    4242
    43438. Disable all swaps from /proc/swaps.
     
    5151`free -h`
    5252 
    53 Install Container runtime
     53'''Install Container runtime'''
    5454
    555510. Configure persistent loading of modules
     
    6969
    707012. Ensure sysctl params are set
    71 {{{
    72 
     71
     72{{{
    7373sudo tee /etc/sysctl.d/kubernetes.conf<<EOF
    74 
    7574net.bridge.bridge-nf-call-ip6tables = 1
    76 
    7775net.bridge.bridge-nf-call-iptables = 1
    78 
    7976net.ipv4.ip_forward = 1
    80 
    8177EOF
    8278}}}
     
    9692
    979316. Configuring a cgroup driver
     94
    9895Both the container runtime and the kubelet have a property called "cgroup driver", which is essential for the management of cgroups on Linux machines.
    9996
     
    108105`systemctl status containerd`
    109106
    110 Initialize control plane
     107'''Initialize control plane'''
     108
    11110918. Make sure that the br_netfilter module is loaded:
    112110
     
    114112
    115113Output should similar to:
     114
    116115{{{
    117116br_netfilter           22256  0
     
    133132You will see Your Kubernetes control-plane has initialized successfully!
    134133
     134You need to save the kubeadm join token string on a text document for future use.
     135
    13513622. To start the cluster, you need to run the following as a regular user (For this scenario we will only use a single host):
    136137 
     
    157158
    158159`kubectl get nodes -o wide`
     160
    15916127. On a master/ control node to query the nodes you can use:
    160162
    161163`kubectl get nodes`
    162164
    163 Scheduling Pods on Kubernetes Master Node
    164 28. By default, Kubernetes Cluster will not schedule pods on the master/control-plane node for security reasons. It is recommended you keep it this way, but for test environments you need to schedule Pods on
    165 control-plane node to maximize resource usage.
    166 
    167 `kubectl taint nodes --all  node-role.kubernetes.io/control-plane-`
     16528. Connecting Worker nodes:
     166
     16728.1. Install docker on both worker nodes as per the guidelines here.(LINK)
     168
     16928.2. Install Kubernetes on each worker nodes. Follow steps 1 to 20.
     170
     17128.3 Use previously saved kubeadm join token string to connect the workers. Run it with sudo.
     172
     173If you forgot the token, run the following on your master to create a new token:
     174
     175`kubeadm token create --print-join-command`
     176
     177But remember, this will create a new token.
     178
     17928.4 After all workers are connected, check status of the cluster: Here after all commands should be run on the master.
     180
     181kubectl get nodes -o wide
    168182
    169183==== Part 2 ====
    170184Create a file simple-pod.yaml
     185
    171186{{{
    172187apiVersion: v1
     
    186201`kubectl apply -f simple-pod.yaml`
    187202
     203Check pod
     204
     205`kubectl get pods`
     206
     207Kill the Pod.
     208
     209`kubectl delete pod nginx`
     210
    188211Pods are generally not created directly and are created using workload resources. See Working with Pods
    189 Links to an external site. for more information on how Pods are used with workload resources
     212[https://kubernetes.io/docs/concepts/workloads/pods/#working-with-pods Links to an external site]. for more information on how Pods are used with workload resources
    190213
    191214==== Part 3 ====
    192215
    193 Deploying a Simple Web Application on Kubernetes
     216'''Deploying a Simple Web Application on Kubernetes'''
     217
    1942181. Create a Deployment Manifest:
     219
    195220A Deployment ensures that a specified number of pod replicas are running at any given time. Let's create a simple Deployment for a web application using the nginx image.
    196221Save the following YAML to a file named webapp-deployment.yaml:
     
    221246
    2222472. Create a Service Manifest:
     248
    223249A Service is an abstraction that defines a logical set of Pods and enables external traffic exposure, load balancing, and service discovery. For our web application, we'll use a NodePort service.
     250
    224251Save the following YAML to a file named webapp-service.yaml:
    225252
     
    266293
    267294You should see the default nginx welcome page, indicating that your web application is running.
     295
     296Delete all the deployments, run below command:
     297
     298`kubectl delete deployment <deployment name>`
     299
     300Delete all the Services, run below command:
     301
     302`kubectl delete service <service name>`
    268303 
    269304Part 4
    270 Deploying WordPress and MySQL on Kubernetes
     305
     306'''Deploying WordPress and MySQL on Kubernetes'''
    271307
    272308Installing dependancies:
     309
    273310Download rancher.io/local-path storage class:
    274311
     
    433470 
    434471Part 5
     472
    435473Convert your Docker deployment into a Kubernetes deployment, you may compose your own service, deployment manifests as needed. Use the docker images you used previously when creating the pods/deployments.
    436474 
    437 Additional ref: https://kubebyexample.com/
     475Additional ref:[ https://kubebyexample.com/]