Kubernetes Notes18 Oct 2023 Day 3
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Working with Kubernetes DaemonSets
What are the ways to Deploy POD?
--------------------------
Pod
ReplicationController
ReplicaSets
Deployment
DeamonSets
StatefulSets
DeamonSets
-------------------------------
Min - Max --- 1 POD per Node
-------------------------------
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: logging
spec:
selector:
matchLabels:
app: httpd-logging
template:
metadata:
labels:
app: httpd-logging
spec:
containers:
- name: webserver
image: httpd
ports:
- containerPort: 80
2004 ls
2005 vi ds.yaml
2006 kubectl apply -f ds.yaml
2007 kubectl get ds
2008 kubectl get pods --all-namespaces
2009 kubectl get pods --all-namespaces | grep logging
2010 kubectl get pods --all-namespaces -o wide | grep logging
2011 clear
2012 ls
2013 kubectl get ds
2014 kubectl describe ds logging
2015 kubectl get nodes
2016 history
Working with Kubernetes Jobs and CronJob
2021 vi job.yaml
2022 kubectl apply -f job.yaml
2023 kubectl get jobs
2024 kubectl get pods
2025 kubectl get jobs
2026 kubectl get pods
2027 kubectl get jobs
2028 kubectl get pods
2029 kubectl get jobs
2030 kubectl get pods
2031 kubectl apply -f job.yaml
2032 kubectl get pods
2033 clear
2034 kubectl describe job pi
2035 clear
2036 vi cron.yaml
2037 kubectl apply -f cron.yaml
2038 kubectl get cronjobs
2039 kubectl get pods
2040 clear
2041 kubectl get cronjobs
2042 kubectl get pods
2043 kubectl get cronjobs
2044 kubectl describe cronjob hello
2045 history
Working with Configmap
2054 ls
2055 vi reverseproxy.conf
2056 kubectl create configmap my-config --from-file=reverseproxy.conf
2057 kubectl get cm
2058 kubectl describe cm my-config
2059 clear
2060 ls
2061 vi cm.yaml
2062 kubectl apply -f cm.yaml
2063 kubectl get pods
2064 history
2065 kubectl exec helloworld-nginx ls /etc/nginx/conf.d
2066 kubectl exec helloworld-nginx more /etc/nginx/conf.d/myconfo.conf
2067 history
Working with Kubernetes service
2029 clear
2030 kubectl apply pod1.yaml
2031 kubectl apply -f pod1.yaml
2032 kubectl apply -f pod2.yaml
2033 kubectl get pods
2034 kubectl get cronjobs
2035 kubectl delete cronjobs hello
2036 kubectl get jobs
2037 kubectl delete jobs pi pi-pl-test1
2038 kubectl get jobs
2039 kubectl get pods
2040 kubectl get pods -o wide
2041 curl http://192.168.0.9
2042 kubectl get pods -o wide
2043 curl http://192.168.1.220
2044 curl http://192.168.1.221
2045 clear
2046 ls
2047 kubectl create svc -h
2048 clear
2049 kubectl get svc
2050 kubectl create svc -h
2051 kubectl create svc clusterip -h
2052 clear
2053 kubectl create service clusterip my-cs --tcp=5678:80
2054 kubectl get svc
2055 kubectl descrive svc my-cs
2056 kubectl describe svc my-cs
2057 curl http://10.103.249.69:5678
2058 kubectl get pods --show-lables
2059 kubectl get pods --show-labels
2060 kubectl get svc --show-labels
2061 kubectl edit svc my-cs
2062 kubectl get svc --show-labels
2063 kubectl get pods --show-labels
2064 kubectl describe svc my-cs
2065 curl http://10.103.249.69:5678
2066 kubectl get pods --show-labels
2067 kubectl edit svc my-cs
2068 kubectl describe svc my-cs
2069 curl http://10.103.249.69:5678
2070 watch curl http://10.103.249.69:5678
2071 clear