0% found this document useful (0 votes)
37 views

Introduction To Kubernetes Submission

This document outlines exercises for deploying and managing Kubernetes resources including pods, deployments, services, configmaps, secrets, persistent volumes, namespaces and more using YAML files and Kubernetes CLI. It also covers automation with Helm and Ansible.

Uploaded by

dharmik jethva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Introduction To Kubernetes Submission

This document outlines exercises for deploying and managing Kubernetes resources including pods, deployments, services, configmaps, secrets, persistent volumes, namespaces and more using YAML files and Kubernetes CLI. It also covers automation with Helm and Ansible.

Uploaded by

dharmik jethva
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Dharmik Jethva 202152309

Exercise Procedure 1: Deploying and Managing Pods

Simple-Pod.yml
apiVersion: v1
kind: Pod
metadata:
name: simple-pod
spec:
containers:
- name: nginx-container
image: nginx:latest
Dharmik Jethva 202152309

Exercise 2: Creating and Managing Deployments

apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-container
image: nginx:latest
ports:
- containerPort: 80
Dharmik Jethva 202152309

Exercise 3: Managing Services with Minikube

apiVersion: v1
kind: Service
metadata:
name: nginx-service
spec:
selector:
app: nginx
ports:
- protocol: TCP
port: 80
targetPort: 80
type: NodePort
Dharmik Jethva 202152309

Deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx-container
image: nginx:latest
ports:
- containerPort: 80
Dharmik Jethva 202152309

Exercise 4: Using ConfigMaps and Secrets

apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-config
data:
nginx.conf: |
server {
listen 80;
server_name localhost;

location / {
root /usr/share/nginx/html;
index index.html;
}
}

apiVersion: v1
kind: Pod
metadata:
name: nginx-pod-configmap
spec:
containers:
- name: nginx-container
image: nginx:latest
volumeMounts:
- name: config-volume
mountPath: /etc/nginx/nginx.conf
subPath: nginx.conf
volumes:
- name: config-volume
configMap:
name: nginx-config
Dharmik Jethva 202152309
Dharmik Jethva 202152309

Exercise 5: Deploying Applications with Helm


Dharmik Jethva 202152309

Exercise 6: Using Persistent Volumes and Persistent Volume Claims


apiVersion: v1
kind: PersistentVolume
metadata:
name: my-pv
spec:
capacity:
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /mnt/data

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: my-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: nginx-container
image: nginx:latest
volumeMounts:
- name: data-volume
mountPath: /mnt/data
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: my-pvc
Dharmik Jethva 202152309
Dharmik Jethva 202152309

Exercise 7: Dashboard, Ingress

Minikube Dashboard
Dharmik Jethva 202152309

Exercise 8: Namespace Management and Cleanup


Dharmik Jethva 202152309

Exercise 9: Ansible for Kubernetes Automation

You might also like