Terraform is the infrastructure as a Code offering from HashiCorp. It is a tool for building, changing, and managing infrastructure in a safe, repeatable way. Operators and Infrastructure teams can use Terraform to manage environments with a configuration language called the HashiCorp Configuration Language (HCL) for human-readable, automated deployments.
The Terraform Associate certification is for Cloud Engineers specializing in operations, IT, or developers who know the basic concepts and skills associated with open-source HashiCorp Terraform. Candidates will be best prepared for this exam if they have professional experience using Terraform in production, but performing the exam objectives in a personal demo environment may also be sufficient.
Infrastructure as Code (IaC) has become more popular recently and makes System Operator’s life easier than ever. With IaC, we can create and destroy the whole infrastructure in minutes, you can maintain the versioning as well. It is obvious that the future is multi-cloud to design fault-tolerant and highly available systems and it’s worth investing in this tool to automate the infrastructure provisioning. If you are someone who is developing applications in a multi-cloud environment you will try it.
There are no official prerequisites for this exam. However, I would highly recommend the following to be better prepared:
Understanding of at least one public cloud provider such as AWS, GCP, etc.
Basic terminal skills and a basic understanding of On-premises and cloud architecture.
Patience to go over Hashicorp terraform documentation :) https://developer.hashicorp.com/terraform/tutorials/certification-003/associate-study-003
Have a completion plan — Set a date to complete this documentation.
Check these https://www.udemy.com/course/terraform-associate-practice-exam/ questions, once you are ready
Check also my GitHub repo(https://github.com/sandhya261996/terraform_project/tree/main/terraform_notes) for better practice its have sets of notes (one detailed one) and one like a cheatsheet, the cheatsheet would be extremely handy to go over before the exams.
This is an online proctored exam with several types of questions such as Multiple Choice, Multiple answers, True or false questions, and text-based questions like fill in the banks. This exam has 57 questions and should be completed in 60 minutes. It is designed to validate the skill set of someone who has some professional experience. The exam costs you $70 and there is no free retake for this exam. You have to complete it successfully in a single take. You get the exam results instantly with the breakdown below and you will receive an email with the same result with the Terraform Certified Associate logo.
The following docs helped me to prepare for the exam:
Setting up Terraform locally with an AWS account & experimenting with things
I took around 15 days to prepare (as am relatively new to Terraform), also tried all the exercises from the Udemy course.
Finally, ensure that you register for your exam (see here).
Understand infrastructure as code (IaC) concepts
Understand Terraform’s purpose (vs other IaC)
Understand Terraform basics
Use the Terraform CLI (outside of core workflow)
Interact with Terraform modules
Navigate Terraform workflow
Implement and maintain state
Read, generate, and modify the configuration
Understand Terraform Cloud and Enterprise capabilities
To be honest, terraform documentation is more than enough for this exam. They have a very good Exam study guide and exam review guide. I would suggest you go through these links in order and would highly recommend you practice while going through these materials.
In the fullness of time, I won't go over the details of the course which is covered very well by a lot of other blogs. I would recommend the Udemy course for those folks who are Terraform newbies. I loved learning the Terraform tool via this course.
Before considering this certification, you should have a basic understanding of at least one public cloud provider such as AWS, GCP, Azure, etc. This is because Terraform is all about provisioning infrastructure on the cloud.
If you don’t have hand-on experience with any cloud provider I would highly recommend you go and learn that. Start with AWS if you are new.
You need to understand declarative programming since Terraform uses a declarative approach towards provisioning infrastructure. You need to tell Terraform what your desired infrastructure and Terraform takes care of it.
Don’t just study the documentation if you don't have real-time experience with the Terraform. You can install Terraform on your local machine and start using it and provisioning infrastructure on AWS.Practice. Practice. practice. This helps with your muscle memory.
Understand the importance of IaC and the benefits that Terraform brings to the system operators as well as developers.
Most of the questions are simple enough and you don’t get to see many scenario questions. But, without actual practical hands-on experience, you might get those wrong.
Remember the important file names that we use in the Terraform configuration such as the plugin cache directory, terraform state file name, the default location of the Terraform configuration file, etc.
This exam is very quick and you have to complete 57 questions in 60 minutes. So, practice well enough so that you can answer confidently without thinking much.
Practice more on the terraform workflow (init, plan, and apply) and understand them very well.
We are moving to a multi-cloud environment and you can’t log in and log out of different cloud providers every time you want to manage resources or you want to have versioning so that you can track. Whatever the reason, Hashicorp Terraform is one of the leading IaC tools its worth investing your time in this.
]]>Kubernetes Services are an essential part of managing containerized applications in a Kubernetes cluster. A Service provides a stable network endpoint for a set of Pods in a Kubernetes cluster, enabling other services to access the applications running in those Pods. In this answer, we will dive deep into Kubernetes Services and cover the following topics:
What is a Kubernetes Service?
Types of Kubernetes Services
How Kubernetes Services work
Kubernetes Service configurations
Service discovery
Load balancing
Scaling Kubernetes Services
Headless Services
Kubernetes Service and DNS
Kubernetes Service vs Ingress
Let's get started!
A Kubernetes Service is an abstraction layer that provides a stable IP address and DNS name for a set of Pods in a Kubernetes cluster. It acts as a load balancer for network traffic and enables communication between different components of a Kubernetes application.
There are three types of Kubernetes Services:
A ClusterIP Service exposes a set of Pods on a cluster-internal IP address. This type of Service is only accessible within the cluster, and other services can access it using the Service's DNS name.
A NodePort Service exposes a set of Pods on a static port on each Node in the cluster. This type of Service is accessible from outside the cluster, and the Service is accessible on each Node's IP address on the static port.
A LoadBalancer Service exposes a set of Pods through an external load balancer. This type of Service is typically used in cloud environments where an external load balancer can be created automatically to distribute traffic to the Service.
When you create a Service, Kubernetes assigns it a virtual IP address (ClusterIP) or static port (NodePort) that acts as a stable endpoint for the Service. The Service monitors the Pods that are associated with it and creates an Endpoints object that lists the IP addresses of the Pods.
When another component in the cluster wants to communicate with the Service, it uses the Service's DNS name. Kubernetes automatically resolves the DNS name to the virtual IP address or static port of the Service, which in turn forwards the traffic to one of the Pods in the associated Endpoints object.
You can configure a Kubernetes Service using YAML or JSON configuration files. Here's an example of a simple Service configuration:
yamlCopy codeapiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: my-app
ports:
- name: http
port: 80
targetPort: 8080
In this example, the Service is named "my-service" and selects Pods labelled with "app=my-app". The Service exposes port 80 and forwards traffic to port 8080 on the Pods.
Kubernetes Services use DNS for service discovery. When you create a Service, Kubernetes creates a DNS entry for it in the form of <service-name>.<namespace>.svc.cluster.local. This DNS name resolves to the virtual IP address of the Service, allowing other components in the cluster to access the Service using its DNS name.
Here is an example YAML file that demonstrates how to create a Kubernetes Service with discovery:
yamlCopy codeapiVersion: v1
kind: Service
metadata:
name: my-service
spec:
selector:
app: my-app
ports:
- name: http
port: 80
targetPort: 8080
In this example, the YAML file creates a Service named "my-service" with a selector of "app: my-app", which means it will target all the Pods with a label of "app=my-app". The Service listens on port 80 and forwards traffic to the Pods on port 8080.
You can use this Service to discover the Pods that are associated with it. For example, you could create a Pod that runs a command to query the DNS of the Service:
yamlCopy codeapiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- name: my-container
image: nginx
command: ["sh", "-c", "nslookup my-service"]
In this example, the YAML file creates a Pod named "my-pod" that runs a command to query the DNS of the Service named "my-service". When you run this Pod, it will output the IP addresses of the Pods that are associated with the Service.
Another way to discover Services in Kubernetes is to use environment variables. When you create a Service, Kubernetes automatically creates environment variables for each Pod in the same namespace that include the IP address and port number of the Service. For example, you could create a Deployment that sets the environment variables for a container:
yamlCopy codeapiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
selector:
matchLabels:
app: my-app
replicas: 2
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: nginx
env:
- name: MY_SERVICE_HOST
value: my-service
- name: MY_SERVICE_PORT
value: "80"
In this example, the YAML file creates a Deployment named "my-deployment" with two replicas. The Deployment sets environment variables for a container that includes the host and port of the Service named "my-service". You can use these environment variables to access the Service from within the container.
Kubernetes Services act as load balancers for network traffic. When a component in the cluster wants to access a Service, it sends a request to the Service's virtual IP address or a static port. The Service forwards the traffic to one of the Pods in its associated Endpoints object using a round-robin load balancing algorithm.
Here is an example YAML file that demonstrates how to create a LoadBalancer Service in Kubernetes:
yamlCopy codeapiVersion: v1
kind: Service
metadata:
name: my-loadbalancer
spec:
type: LoadBalancer
selector:
app: my-app
ports:
- name: http
port: 80
targetPort: 8080
In this example, the YAML file creates a Service named "my-load balancer" with a type of "LoadBalancer". The Service is defined with a selector of "app: my-app", which means it will target all the Pods with a label of "app=my-app". The Service listens on port 80 and forwards traffic to the Pods on port 8080.
When you create a Service with a type of "LoadBalancer", Kubernetes will automatically provision a load balancer in the cloud provider's infrastructure and assign it a public IP address. You can use this IP address to access the Service from outside the cluster.
Note that the exact configuration of the load balancer may depend on the cloud provider you are using. Some cloud providers allow you to specify additional configuration options in the Service YAML file, such as the type of load balancer, the protocol, or SSL termination settings. You can consult the documentation of your cloud provider for more information on how to configure LoadBalancer Services in Kubernetes.
You can scale a Kubernetes Service by scaling
How to expose Kubernetes workloads to the outside world using Services?**
Kubernetes provides several ways to expose workloads outside of the cluster and make them accessible to users on the internet or other networks.
\>>One way to expose a workload is to use a Service with a type of "LoadBalancer". When you create a Service of this type, Kubernetes automatically provisions a load balancer in the cloud provider's infrastructure and configures it to route traffic to the Service. The load balancer is assigned a public IP address, which can be used by users to access the Service from outside the cluster.
\>>Another way to expose a workload is to use a Service with a type of "NodePort". When you create a Service of this type, Kubernetes allocates a port on each node in the cluster and configures the node's firewall to forward traffic to the Service. Users can access the Service by using the public IP address of any node in the cluster, along with the allocated port number.
\>>A third way to expose a workload is to use an Ingress resource. An Ingress is a Kubernetes resource that defines a set of routing rules for HTTP and HTTPS traffic. You can use an Ingress to expose multiple Services under a single IP address and to configure SSL/TLS termination and other advanced features such as path-based routing.
To use an Ingress, you need to deploy an Ingress controller in your cluster. An Ingress controller is a pod that runs a software application to implement the Ingress rules and manage the routing of traffic. There are several open-source and commercial Ingress controllers available for Kubernetes, including Nginx, Traefik, and Istio.
Overall, Kubernetes provides several options for exposing workloads outside of the cluster and making them accessible to users on the internet or other networks. By using the appropriate method for your needs, you can ensure that your applications are secure, scalable, and reliable.
To expose a Kubernetes workload to the outside world using a Service, you can use a Service with a type of "LoadBalancer" or "NodePort".
Here is an example YAML file that demonstrates how to create a Service with a type of "LoadBalancer" to expose a workload:
yamlCopy codeapiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: LoadBalancer
ports:
- name: http
port: 80
targetPort: 8080
selector:
app: my-app
In this example, the YAML file creates a Service named "my-service" with a type of "LoadBalancer". The Service listens on port 80 and forwards traffic to the Pods with the label "app=my-app" on port 8080. The cloud provider will automatically provision a load balancer and assign it a public IP address, which can be used to access the Service from outside the cluster.
Here is an example YAML file that demonstrates how to create a Service with a type of "NodePort" to expose a workload:
yamlCopy codeapiVersion: v1
kind: Service
metadata:
name: my-service
spec:
type: NodePort
ports:
- name: http
port: 80
targetPort: 8080
nodePort: 30000
selector:
app: my-app
In this example, the YAML file creates a Service named "my-service" with a type of "NodePort". The Service listens on port 80 and forwards traffic to the Pods with the label "app=my-app" on port 8080. The Service is exposed on port 30000 on each node in the cluster, and users can access the Service using the public IP address of any node in the cluster along with the allocated port number.
Overall, by using YAML files like these to define Services in Kubernetes, you can easily expose your workloads to the outside world and make them accessible to users on the internet or other networks.
Kubernetes DNS (Domain Name System) is a built-in DNS service that provides service discovery for Kubernetes Services and Pods. It allows components in a Kubernetes cluster to discover and communicate with each other using DNS names instead of IP addresses.
When you create a Kubernetes Service, Kubernetes automatically creates a DNS entry for it in the form of <service-name>.<namespace>.svc.cluster.local. This DNS entry resolves to the virtual IP address of the Service, which acts as a stable endpoint for the Service. Other components in the cluster can access the Service using its DNS name.
For example, if you have a Service named "my-service" in the "default" namespace, its DNS name would be "my-service.default.svc.cluster.local". Other components in the cluster can access the Service using this DNS name.
Kubernetes also provides DNS entries for Pods. When you create a Pod, Kubernetes assigns it a unique hostname in the form of <pod-name>.<pod-namespace>.pod.cluster.local. This hostname resolves to the IP address of the Pod.
For example, if you have a Pod named "my-pod" in the "default" namespace, its hostname would be "my-pod.default.pod.cluster.local". Other components in the cluster can access the Pod using its hostname.
By default, Kubernetes uses the CoreDNS DNS server to provide DNS services for the cluster. You can configure CoreDNS using a ConfigMap. Here's an example of a simple CoreDNS configuration:
yamlCopy codeapiVersion: v1
kind: ConfigMap
metadata:
name: coredns
namespace: kube-system
data:
Corefile: |
.:53 {
errors
health
kubernetes cluster.local in-addr.arpa ip6.arpa {
pods insecure
upstream
fallthrough in-addr.arpa ip6.arpa
}
prometheus :9153
forward . /etc/resolv.conf
cache 30
loop
reload
loadbalance
}
In this example, the core file defines a DNS server that listens on port 53 and forwards DNS requests to the Kubernetes DNS service. The Kubernetes DNS service resolves DNS names for Kubernetes Services and Pods. The configuration also includes settings for health checks, Prometheus metrics, caching, and load balancing.
Kubernetes DNS provides service discovery for Kubernetes Services and Pods using DNS names. It allows components in a Kubernetes cluster to communicate with each other using DNS names instead of IP addresses. Kubernetes uses the CoreDNS DNS server to provide DNS services for the cluster, and you can configure CoreDNS using a ConfigMap.
In Kubernetes, DNS records are automatically created for several types of objects, including Services, Pods, and Endpoints.
When you create a Service in Kubernetes, a DNS record is automatically created with the format <service-name>.<namespace>.svc.cluster.local. This DNS record maps to the IP address of the Service, and can be used by other components in the cluster to access the Service.
Each Pod in Kubernetes is also assigned a unique hostname and IP address, and a DNS record is automatically created for the Pod with the format <pod-name>.<pod-namespace>.pod.cluster.local. This hostname can be used by other components in the cluster to access the Pod.
When you create an Endpoint object in Kubernetes, which represents a set of network endpoints that implement a Service, a DNS record is automatically created with the format <service-name>.<namespace>.svc.cluster.local. This DNS record maps to the IP addresses of the endpoints.
In addition to these objects, custom DNS records can also be created to map domain names to IP addresses or to provide hostname resolution for specific resources in the cluster. This can be useful when you have multiple Services or Pods that need to be accessed using a single domain name.
Overall, DNS records play a crucial role in enabling service discovery and hostname resolution within the cluster. By using DNS records effectively, you can simplify communication between components in your Kubernetes cluster and provide a consistent and reliable experience for users.
DNS records play an important role in Kubernetes because they provide a mechanism for discovering and accessing resources in the cluster. In Kubernetes, DNS records are used to map service names to IP addresses and to provide hostname resolution for Pods.
When you create a Kubernetes Service, a DNS record is automatically created for it. The DNS record is of the form <service-name>.<namespace>.svc.cluster.local, where <service-name> is the name of the Service, <namespace> is the namespace the Service is in and svc.cluster.local is the default domain used by Kubernetes. This DNS record maps to the IP address of the Service.
For example, if you have a Service named "my-service" in the "default" namespace, its DNS record would be "my-service.default.svc.cluster.local". Other components in the cluster can access the Service using this DNS name.
Each Pod in Kubernetes is assigned a unique hostname and IP address. The hostname is of the form <pod-name>.<pod-namespace>.pod.cluster.local, where <pod-name> is the name of the Pod, <pod-namespace> is the namespace the Pod is in and pod.cluster.local is the default domain used by Kubernetes. This hostname can be used by other components in the cluster to access the Pod.
For example, if you have a Pod named "my-pod" in the "default" namespace, its hostname would be "my-pod.default.pod.cluster.local". Other components in the cluster can access the Pod using this hostname.
In addition to the default DNS records created by Kubernetes, you can also create custom DNS records to map domain names to IP addresses or to provide hostname resolution for specific resources in the cluster. This can be useful when you have multiple Services or Pods that need to be accessed using a single domain name.
To create a custom DNS record in Kubernetes, you can create a ConfigMap with the desired DNS configuration and mount it as a volume in your Pods. The ConfigMap can contain DNS entries in the form of <hostname>: <ip-address>, where <hostname> is the hostname to map and <ip-address> is the IP address to map it to.
DNS records in Kubernetes play a crucial role in enabling service discovery and hostname resolution within the cluster. Service DNS records map service names to IP addresses, while Pod DNS records provide hostname resolution for Pods. Custom DNS records can also be created to map domain names to IP addresses or to provide hostname resolution for specific resources in the cluster. By using DNS records effectively, you can simplify communication between components in your Kubernetes cluster.
In Kubernetes, a pod is the smallest and simplest unit in the Kubernetes object model, which represents a single instance of a running process in the cluster. A pod can contain one or more containers that share the same network namespace and can communicate with each other via the local host.
Pods are designed to be ephemeral and can be created, deleted, and replaced at any time. Kubernetes uses pods to deploy and manage containerized applications and services. By grouping one or more containers in a pod, Kubernetes provides a simple and efficient way to manage and orchestrate containerized applications.
Each pod in Kubernetes has a unique IP address, and it can be exposed to the network using a service. Pods are typically deployed and managed by higher-level Kubernetes objects, such as ReplicaSets, Deployments, and StatefulSets, which provide additional features for scaling, self-healing, and managing the lifecycle of the pods.
"A records" refer to the DNS records that map a domain name to an IPv4 address. Pods in Kubernetes do not have A records as they do not have a stable IP address. Instead, each pod in Kubernetes is assigned a unique IP address within the cluster's network.
When a pod is created, it is assigned an IP address from the cluster's PodCIDR range. This IP address is used to communicate with other pods and services within the same Kubernetes cluster. However, this IP address is not stable and can change if the pod is rescheduled to a different node or deleted and recreated. Therefore, it is not recommended to use the pod's IP address directly for communication.
To enable communication with pods, Kubernetes provides a service abstraction that exposes a stable IP address and DNS name for a set of pods. A service is associated with one or more pods using a selector and can be accessed using the service's DNS name or IP address.
In summary, pods in Kubernetes do not have A records, but they are assigned a unique IP address that is used for internal communication within the cluster. Services provide a stable IP address and DNS name for accessing pods in Kubernetes.
In Kubernetes, a pod's hostname and subdomain fields are used to set the hostname and subdomain for the pod's containers.
The hostname field specifies the hostname for the pod. If the hostname field is not set, Kubernetes will automatically generate a hostname for the pod using the pod name as the prefix and a random string as the suffix.
The subdomain field specifies the subdomain for the pod. This field is used to create a fully qualified domain name (FQDN) for the pod. The FQDN is created by concatenating the pod name, the subdomain field, and the cluster's default domain name. For example, if the subdomain field is set to "web" and the cluster's default domain name is "cluster. local", the FQDN for the pod will be "pod name.web.cluster.local".
The hostname and subdomain fields can be useful for configuring applications that require a specific hostname or FQDN to function properly. They can also be used to enable service discovery within the cluster by providing a predictable hostname or FQDN for other pods or services to connect to.
It's worth noting that the hostname and subdomain fields are only used for internal DNS resolution within the cluster. They do not affect external DNS resolution or the pod's IP address.
In Kubernetes, a pod's DNS policy determines how the pod's DNS resolution is configured.
There are three DNS policy options available for pods in Kubernetes:
Default - This is the default DNS policy for pods in Kubernetes. In this policy, the pod inherits the DNS settings from the node it is running on. This means that the pod will use the DNS server(s) configured on the node for DNS resolution.
ClusterFirst - In this DNS policy, Kubernetes sets up a DNS server for the pod to use. The DNS server is located at a well-known IP address (10.96.0.10) and is provided by the kubelet service. If the pod's DNS query matches a Kubernetes service or a pod with a hostname in the same namespace, the DNS server returns the corresponding IP address. Otherwise, the DNS server forwards the query to the upstream DNS server(s) configured on the node.
None - In this DNS policy, the pod has no DNS resolution configured. The pod must be able to communicate with other pods and services using IP addresses only. This DNS policy is useful for pods that do not require DNS resolution, or for pods that have custom DNS resolution requirements.
The DNS policy can be set at the pod level or at the container level using the DNS policy field in the pod or container specification. If the DNS policy is set at the container level, it will override the pod-level DNS policy.
It's important to choose the appropriate DNS policy for your pod based on its DNS
When a pod's DNS policy is set to "ClusterFirstWithHostNet", the pod's DNS resolution is configured to use the node's DNS resolver, and the pod shares the network namespace with the node. This means that the pod can access the node's localhost interface and services running on the node's host network.
Here is an example YAML manifest for a pod with the dnsPolicy set to "ClusterFirstWithHostNet":
yamlCopy codeapiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
dnsPolicy: ClusterFirstWithHostNet
hostNetwork: true
containers:
- name: my-container
image: my-image
In this example, the dnsPolicy is set to "ClusterFirstWithHostNet", and the hostNetwork field is set to true. This allows the pod to share the network namespace with the node and use the node's DNS resolver.
If the pod's DNS query matches a Kubernetes service or a pod with a hostname in the same namespace, the Kubernetes DNS server will return the corresponding IP address. Otherwise, the DNS query is forwarded to the node's DNS resolver.
Using the "ClusterFirstWithHostNet" DNS policy is useful for certain types of workloads that require access to services running on the node's host network or need to resolve DNS queries using the node's DNS resolver. However, it can also introduce security risks, so it should be used with caution.
In Kubernetes, a pod's DNS configuration determines how DNS resolution is configured for the pod. This configuration can be used to customize the DNS settings for the pod and can be set using the dnsConfig field in the pod specification.
The dnsConfig field allows you to configure the following DNS settings for the pod:
nameservers - Specifies a list of IP addresses for DNS servers to use for DNS resolution.
searches - Specifies a list of DNS search domains to use for DNS resolution.
options - Specify a list of DNS options to use for DNS resolution.
The dnsConfig field can be set at the pod level or at the container level using the dnsConfig field in the pod or container specification. If the dnsConfig field is set at the container level, it will override the pod-level DNS configuration.
The dnsConfig field is useful for customizing DNS resolution for pods that require specific DNS settings or for integrating with external DNS servers or services.
It's worth noting that the dnsConfig field is only applicable when the pod's DNS policy is set to ClusterFirst. When the DNS policy is set to Default or None, the pod inherits the DNS settings from the node it is running on, and the dnsConfig field is ignored.
Here is an example YAML manifest for a pod with custom DNS settings:
yamlCopy codeapiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
dnsPolicy: ClusterFirst
containers:
- name: my-container
image: my-image
dnsConfig:
nameservers:
- 8.8.8.8
- 8.8.4.4
searches:
- mydomain.com
options:
- ndots:2
In this example, the dnsPolicy is set to "ClusterFirst", and the dnsConfig field is used to specify custom DNS settings for the container. The nameservers field specifies a list of IP addresses for DNS servers to use for DNS resolution. In this case, the container will use Google's public DNS servers. The searches field specifies a list of DNS search domains to use for DNS resolution. In this case, the container will search for DNS queries in the "mydomain.com" domain. The options field specifies a list of DNS options to use for DNS resolution. In this case, the container is configured to perform a DNS lookup with at least two dots in the name before trying to append the search domain.
Custom DNS settings can be useful for pods that require specific DNS configurations or for integrating with external DNS servers or services.
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>In Kubernetes, a workload refers to the set of instructions that specify how to run a containerized application. A workload in Kubernetes can be thought of as a higher-level abstraction that sits on top of Kubernetes objects like Pods, Services, and Deployments.
Kubernetes supports several types of workloads, each with its unique characteristics and use cases:
Deployments: Deployments are the most commonly used workload in Kubernetes. They manage a set of replicas of a pod and provide the ability to update and roll back to previous versions of the application.
StatefulSets: StatefulSets are used to manage stateful applications, such as databases or distributed systems. They ensure that each replica has a unique identity and that storage is preserved across pod restarts.
DaemonSets: DaemonSets are used to ensure that a pod is running on all nodes in a cluster. They are typically used for monitoring or logging agents.
Jobs: Jobs are used to run a batch process or a one-time task to completion. They ensure that the task runs to completion, and the pod is terminated when the job is finished.
CronJobs: CronJobs are used to schedule a task to run at a specific time or interval. They are typically used for periodic maintenance tasks or data processing.
Workloads are defined using Kubernetes manifest files written in YAML or JSON, which describe the desired state of the application. Kubernetes then uses these manifest files to create and manage the necessary resources in the cluster.
In summary, workloads in Kubernetes provide a higher-level abstraction that enables developers to manage complex containerized applications easily. They allow for easy scaling, rolling updates, and fault tolerance, which are critical for running applications in production environments.
here is an example Kubernetes manifest file written in YAML that defines a Deployment workload:
yamlCopy codeapiVersion: apps/v1
kind: Deployment
metadata:
name: my-app
labels:
app: my-app
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: my-app-image:latest
ports:
- containerPort: 8080
In this example, the manifest file creates a Deployment called "my-app" that will run three replicas of a containerized application called "my-app-container". The application will be accessible on port 8080, and the image used for the container is "my-app-image: latest".
The manifest file also defines labels for the Deployment and its pods, which can be used for easy management and querying of resources in the Kubernetes cluster.
In Kubernetes, a Deployment is a resource that manages the creation and scaling of a set of identical Pods. Deployments ensure that the desired number of replicas of a Pod is running and allow for rolling updates and rollbacks of the application.
A real-time example of how Deployments are used in Kubernetes is as follows: Imagine you have a web application that is running in a Kubernetes cluster, and you want to update the application to a new version. Instead of manually updating each Pod, you can use a Deployment to manage the update for you.
Here is a step-by-step example of how Deployments are used in this scenario:
Create a Deployment: You would create a new Deployment object in Kubernetes that specifies the desired state of the updated application. This would include details such as the new version of the application, the number of replicas to be created, and any other configuration settings.
Kubernetes creates new Pods: Once the Deployment is created, Kubernetes would create the necessary number of Pods to match the desired state specified in the Deployment.
Roll out the update: Kubernetes would then perform a rolling update of the application, updating each Pod one at a time. This ensures that there is always a certain number of healthy Pods running the application, even during the update process.
Verify the new version: After the update is complete, you can verify that the new version of the application is running as expected. If there are any issues, you can easily roll back to the previous version of the application by updating the Deployment object.
Deployments are a critical resource in Kubernetes, as they allow for easy management of containerized applications at scale. They provide the ability to perform rolling updates, which minimize downtime during updates and ensure that there is always a certain number of healthy replicas of the application running. Deployments are also a key component of the self-healing nature of Kubernetes, as they automatically handle failed Pods and ensure that the desired state of the application is maintained.
here is an example of a Kubernetes Deployment manifest file:
yamlCopy codeapiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-deployment
labels:
app: myapp
spec:
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: myapp:latest
ports:
- containerPort: 8080
In this example, the manifest file creates a Deployment resource named "myapp-deployment". The Deployment manages a set of three replicas of a containerized application with the label "app: myapp".
The Deployment specifies the desired state of the application by defining the number of replicas to be created and the container image to be used. In this case, the application image is "myapp: latest", and it will run on port 8080.
The manifest file also includes a selector that specifies which Pods the Deployment should manage. In this case, the selector is "app: myapp", which matches the label of the Pods created by the Deployment.
This Deployment can be applied to a Kubernetes cluster using the "kubectl apply" command, and Kubernetes will automatically create the necessary resources to manage the desired state of the application.
In Kubernetes, a StatefulSet is a resource that manages the deployment and scaling of a set of Pods, each of which has a unique and persistent identity. Unlike a Deployment, which manages stateless applications, a StatefulSet is designed for stateful applications that require stable network identities and persistent storage.
Some examples of stateful applications that could benefit from using StatefulSets include databases, message queues, and storage systems.
Here are some of the key features and benefits of using StatefulSets in Kubernetes:
Stable network identities: Each Pod in a StatefulSet is assigned a unique and stable hostname that persists across rescheduling. This enables stateful applications to maintain a consistent network identity, which is important for many applications, such as databases.
Ordered deployment and scaling: StatefulSets ensure that Pods are deployed and scaled in a specific order, which is important for stateful applications that have dependencies or require a specific initialization order.
Persistent storage: StatefulSets can automatically provision and manage persistent storage for each Pod, which is essential for many stateful applications.
Automatic rescheduling: If a Pod in a StatefulSet fails, Kubernetes will automatically reschedule it to run on a different node in the cluster.
Here is an example of a StatefulSet manifest file in Kubernetes:
yamlCopy codeapiVersion: apps/v1
kind: StatefulSet
metadata:
name: myapp-statefulset
spec:
serviceName: myapp
replicas: 3
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: myapp:latest
ports:
- containerPort: 8080
volumeMounts:
- name: myapp-data
mountPath: /data
volumeClaimTemplates:
- metadata:
name: myapp-data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: "standard"
resources:
requests:
storage: 1Gi
In this example, the manifest file creates a StatefulSet resource named "myapp-statefulset". The StatefulSet manages a set of three replicas of a containerized application with the label "app: myapp".
The manifest file also specifies that the StatefulSet should create a service named "myapp" to manage network connections to the Pods.
Each Pod in the StatefulSet is assigned a unique and stable hostname, and the Pod also has access to persistent storage through a volume mount. The volume is provisioned using a volumeClaimTemplate, which specifies the storage requirements for the Pod.
This StatefulSet can be applied to a Kubernetes cluster using the "kubectl apply" command, and Kubernetes will automatically create the necessary resources to manage the stateful application.
In Kubernetes, a DaemonSet is a resource that manages the deployment and scaling of a set of Pods that run on all or a subset of the nodes in a cluster. Unlike a Deployment or a StatefulSet, which manages a set of Pods that run on a subset of nodes, a DaemonSet ensures that a specific Pod runs on every node or a subset of nodes in a cluster.
DaemonSets are commonly used for tasks that need to be performed on every node in a cluster, such as monitoring, logging, or network management.
Here are some of the key features and benefits of using DaemonSets in Kubernetes:
Automatic deployment and scaling: DaemonSets automatically deploy and scale Pods to run on every node or a subset of nodes in a cluster.
Node-level management: DaemonSets enable node-level management of Pods, which is useful for tasks that need to be performed on every node in a cluster.
Rolling updates: DaemonSets support rolling updates, which enable a new version of a Pod to be deployed and updated on each node in a controlled manner.
Automatic rescheduling: If a node fails or is added to the cluster, Kubernetes will automatically reschedule the Pod to run on a different node in the cluster.
Here is an example of a DaemonSet manifest file in Kubernetes:
yamlCopy codeapiVersion: apps/v1
kind: DaemonSet
metadata:
name: myapp-daemonset
spec:
selector:
matchLabels:
app: myapp
template:
metadata:
labels:
app: myapp
spec:
containers:
- name: myapp
image: myapp:latest
ports:
- containerPort: 8080
In this example, the manifest file creates a DaemonSet resource named "myapp-daemonset". The DaemonSet ensures that a Pod with the label "app: myapp" runs on every node in the cluster.
The manifest file specifies that each Pod should use the container image "myapp: latest" and listen on port 8080.
This DaemonSet can be applied to a Kubernetes cluster using the "kubectl apply" command, and Kubernetes will automatically create the necessary resources to manage the deployment of the Pod on every node in the cluster.
In Kubernetes, a Job is a resource that manages the execution of a specific task or batch job in a cluster. Jobs are useful for running tasks that are expected to complete successfully and do not require manual intervention.
Here are some of the key features and benefits of using Jobs in Kubernetes:
One-time execution: Jobs are designed to execute a specific task or batch job one time and then terminate. This is useful for tasks such as data processing, report generation, or backups.
Automatic cleanup: Kubernetes automatically cleans up completed Jobs and their associated Pods, which reduces clutter and keeps the cluster organized.
Parallel execution: Jobs can be configured to execute multiple instances of the task in parallel, which can improve performance and reduce execution time.
Error handling: Jobs can be configured to handle errors and retries, which ensures that the task is completed successfully even in the presence of failures.
Here is an example of a Job manifest file in Kubernetes:
yamlCopy codeapiVersion: batch/v1
kind: Job
metadata:
name: myapp-job
spec:
template:
metadata:
name: myapp-job
spec:
containers:
- name: myapp
image: myapp:latest
command: ["./myapp"]
args: ["--input", "data.csv"]
restartPolicy: Never
In this example, the manifest file creates a Job resource named "myapp-job". The Job runs a batch job that executes a command named "myapp" with the argument "--input data.csv".
The manifest file also specifies that the Job should create a Pod that uses the container image "myapp: latest" and has a restart policy of "Never", which means that the Pod is not restarted if it fails or terminates.
This Job can be applied to a Kubernetes cluster using the "kubectl apply" command, and Kubernetes will automatically create the necessary resources to manage the execution of the batch job. Once the job is completed, Kubernetes will clean up the resources associated with the job.
In Kubernetes, a CronJob is a resource that manages the scheduling and execution of Jobs in a cluster. CronJobs are used to run tasks at regular intervals or at specific times.
Here are some of the key features and benefits of using CronJobs in Kubernetes:
Scheduled execution: CronJobs enable the scheduling and execution of Jobs at regular intervals or at specific times, similar to the Unix cron daemon.
Repeatable tasks: CronJobs are useful for executing repeatable tasks, such as backups, log rotation, or database maintenance.
Automatic cleanup: Kubernetes automatically cleans up completed Jobs and their associated Pods, which reduces clutter and keeps the cluster organized.
Error handling: CronJobs can be configured to handle errors and retries, which ensures that the task is completed successfully even in the presence of failures.
Here is an example of a CronJob manifest file in Kubernetes:
yamlCopy codeapiVersion: batch/v1
kind: CronJob
metadata:
name: myapp-cronjob
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
metadata:
name: myapp-job
spec:
containers:
- name: myapp
image: myapp:latest
command: ["./myapp"]
args: ["--input", "data.csv"]
restartPolicy: Never
In this example, the manifest file creates a CronJob resource named "myapp-cronjob". The CronJob is configured to run a Job every 5 minutes using a cron-like schedule string "*/5 ".
The manifest file also specifies that the Job should create a Pod that uses the container image "myapp:latest" and has a restart policy of "Never", which means that the Pod is not restarted if it fails or terminates.
This CronJob can be applied to a Kubernetes cluster using the "kubectl apply" command, and Kubernetes will automatically create the necessary resources to manage the scheduling and execution of the Job at the specified interval. Once the Job is completed, Kubernetes will clean up the resources associated with the Job.
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Kubernetes has become the go-to container orchestration platform for organizations of all sizes. Kubernetes networking is a crucial aspect of managing containerized applications and services in a Kubernetes cluster. It involves the configuration and management of network resources to facilitate communication between containers and services running on different nodes in the cluster.
However, with great power comes great complexity, and networking is one of the most challenging aspects of managing a Kubernetes cluster. In this blog, we will dive deep into Kubernetes networking and explore key concepts such as services, ingress, network policies, DNS, and CNI plugins.
There are several networking options available for Kubernetes, including:
Kubernetes Service: Kubernetes service is a virtual IP address that provides a stable endpoint for a set of pods. It helps to abstract the underlying network infrastructure and provides a consistent interface for communication between pods.

Kubernetes Services provide a stable IP address and DNS name that can be used to access a set of pods running in the cluster. Services abstract away the underlying network details, allowing pods to communicate with each other without needing to know their exact IP addresses or hostnames.
Services can be used to implement load balancing, failover, and service discovery. For example, you can create a Service that load balances traffic across a set of backend pods, ensuring that requests are evenly distributed and that the backend pods can be scaled up or down without impacting the availability of the service.
Cluster Networking: Kubernetes cluster networking is responsible for managing communication between the nodes in the cluster. It includes network policies, routing, and load balancing.

Cluster networking in Kubernetes is responsible for routing traffic between pods running on different nodes in the cluster. Kubernetes provides a default networking implementation called the Kubernetes Container Network Interface (CNI), which allows for the use of various networking plugins.
The CNI allows for a wide range of network policies, including network isolation, port-level security, and traffic shaping. Different networking plugins can be used to implement different networking features, such as load balancing, network segmentation, and packet filtering.
Container Network Interface (CNI): The CNI is a specification that defines the interface between the container runtime and the network provider. It allows Kubernetes to use a wide variety of networking solutions, such as Flannel, Calico, and Weave.

The Container Network Interface (CNI) is a specification that defines how container runtimes interface with the network provider. It allows Kubernetes to use a variety of network providers and plugins, depending on the specific requirements of the application.
CNI plugins can provide different types of network topologies, such as overlay networks, host-based networks, and bridge networks. They can also provide advanced features, such as network segmentation, encryption, and traffic shaping.

CNI plugins allow Kubernetes to configure the networking for each pod at runtime. The CNI plugin is responsible for setting up the network interface for each pod and connecting it to the appropriate network. This includes assigning IP addresses, setting up routing tables, and configuring network security policies.
Some of the most popular CNI plugins include Calico, Flannel, Weave Net, and Cilium.
Ingress Networking: Kubernetes Ingress is an API that provides a way to manage external access to services running in a Kubernetes cluster. It allows for the configuration of rules for routing traffic to different services based on hostnames and URLs.
Ingress networking is used to expose HTTP and HTTPS services running in a Kubernetes cluster to the outside world. The Kubernetes Ingress resource provides a way to configure rules for routing traffic from the external network to backend services running in the cluster.

Ingress can be used to implement complex routing rules, SSL termination, and load balancing. Different ingress controllers can be used to provide different features, such as the ability to route traffic based on URL path or header values, or to provide advanced traffic management features like traffic shaping and rate limiting.
Network Policies: Kubernetes Network Policies are a powerful feature that allows you to control the traffic flow to and from Kubernetes pods. Network Policies are implemented using rules that define what traffic is allowed or denied between pods. This provides a way to enforce security policies and prevent unauthorized access to resources.

Network Policies are defined using a YAML file that specifies the allowed traffic flow between pods. The file contains a list of rules that specify the source and destination pods, protocols, ports, and other parameters. For example, you can create a Network Policy that allows traffic from a specific pod to access a database pod while denying traffic from all other pods.
Network Policies can be applied to a specific namespace or the entire cluster. They are enforced by a network plugin, such as Calico, that intercepts traffic and applies the policy rules. If traffic does not match a rule, it is denied by default.
Network Policies are particularly useful for securing microservices-based architectures, where each service runs in its pod and communicates with other services over the network. By using Network Policies, you can enforce strict security policies and prevent unauthorized access to sensitive data.
Here are some common use cases for Network Policies in Kubernetes:
Isolating workloads: Network policies can be used to isolate different workloads from each other, preventing them from accessing each other's resources.
Restricting ingress and egress traffic: You can use Network Policies to control which pods are allowed to receive traffic from the outside world, or which pods are allowed to send traffic outside of the cluster.
Enforcing security policies: Network policies can be used to enforce security policies, such as limiting access to sensitive services to a specific set of pods, or enforcing encryption and authentication requirements for all network traffic.
Enabling compliance requirements: Network policies can help you meet compliance requirements by ensuring that only authorized traffic flows between pods, and by logging and auditing all network traffic.
DNS: DNS in Kubernetes refers to the Kubernetes DNS service, which provides a way for Kubernetes services to discover and communicate with each other using domain names.
When a Kubernetes service is created, a DNS record is automatically created for it in the Kubernetes DNS service. This allows other services in the cluster to refer to the service using its DNS name instead of its IP address, which can change frequently.

The Kubernetes DNS service also provides name resolution for Kubernetes pods, which are the smallest deployable units in a Kubernetes cluster. Each pod is assigned a unique hostname, and the Kubernetes DNS service maintains a mapping of each pod's hostname to its IP address.
Overall, the Kubernetes DNS service simplifies communication between services and pods in a Kubernetes cluster by providing a consistent and reliable way to refer to them using domain names.
In summary, Kubernetes networking is a complex topic that requires careful consideration of the specific requirements of your application. The different networking options available in Kubernetes provide a wide range of features that can be used to implement different types of networking topologies and advanced network policies. The specific networking options that you choose will depend on your specific requirements, such as the need for load balancing, security, or traffic shaping.
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Kubernetes architecture is designed as a distributed system that spans across multiple nodes, where each node is an instance of the Kubernetes cluster. The architecture can be divided into two main components: the control plane and the worker nodes.
a. API Server: It provides a RESTful API for communication with the Kubernetes cluster. The API server is responsible for validating and processing requests and updating the state of the Kubernetes cluster.
b. etcd: It is a distributed key-value store that stores the configuration data and the state of the Kubernetes cluster. It is used as the backend data store for Kubernetes.
c. Controller Manager: It is responsible for managing various controllers that are responsible for maintaining the desired state of the Kubernetes cluster. It detects changes in the cluster and takes corrective actions to bring the cluster back to the desired state.
d. Scheduler: It is responsible for scheduling pods on the worker nodes based on resource availability, constraints, and other policies. It ensures that pods are scheduled to the right nodes.
a. Kubelet: It is responsible for managing the lifecycle of pods on a node. It communicates with the API server to get the configuration of the pods assigned to the node and ensures that the pods are running as expected.
b. Container Runtime: It is responsible for running the containers inside the pods. Kubernetes supports several container runtimes, including Docker, containers, and CRI-O.
c. kube-proxy: It is responsible for providing networking services to the pods running on the node. It forwards traffic to the appropriate pod based on the IP address and port number.
d. Pod: A pod is the smallest unit of deployment in Kubernetes. It is a logical host for one or more containers and can be scheduled on a worker node. A pod can share network, storage, and other resources with other pods running on the same node.
Overall, the architecture of Kubernetes is designed to be highly scalable, fault-tolerant, and flexible. It allows users to deploy and manage containerized applications on a large scale while providing a simple and consistent interface to the developers.
Here are the steps to install and configure Kubernetes on an EC2 instance:
Step 1: Launch EC2 Instance
a.) First, launch an EC2 instance. You can use the Amazon Linux AMI or any other Linux distribution that you prefer.

b.) Make sure that the instance has at least 2GB of RAM and 2 CPUs.(t2.medium)

sudo yum update

Step 2: Install Docker
Install Docker on the EC2 instance using the following command: sudo yum install -y docker

Step 3: Install Kubernetes
Add the Kubernetes repository to the EC2 instance using the following command: sudo vi /etc/yum.repos.d/kubernetes.repo
Add the following lines to the file:
Install Kubernetes using the following command: sudo yum install -y kubelet kubeadm kubectl
Start the Kubernetes services using the following command: sudo systemctl enable kubelet && sudo systemctl start kubelet
Step 4: Configure Kubernetes
Initialize the Kubernetes cluster using the following command: sudo kubeadm init
Copy the kubeconfig file to your home directory using the following command: mkdir -p $HOME/.kube && sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config && sudo chown $(id -u):$(id -g) $HOME/.kube/config
Install the Kubernetes network add-on using the following command: sudo kubectl apply -f https://docs.projectcalico.org/v3.8/manifests/calico.yaml
Step 5: Join Nodes in the Cluster
That's it! You now have a Kubernetes cluster running on your EC2 instance.
step: 1 curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube

step: 2 Use minikube start --driver=docker

sudo usermod -aG docker $USER && newgrp docker

minikube ssh


sudo snap install kubectl --classic

Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>As Jenkins is still a popular automation server used for continuous integration and deployment.
Jenkins is integrated with the Git repository to pull the source code and perform analysis, build the project, execute the unit testing, and finally deploy the application on the production servers. These tasks are automated sequences of stages to provide continuous release of the software. workflow from Git to production using Jenkins to incorporate continuous code changes and bug fixes by the development and testing teams.
Manual & very slow-paced traditional software release process
Poor Time to Market
Complicated and Manual testing processes
Weak competitive advantage
Poor adapt to change
Poor customer experience
High application downtime
Error-prone manual operations
Jenkins with a master and slave architecture for automated build and testing
An Auto Scaling Group (ASG) to ensure an EC2 instance running the Jenkins controller is up and running 24/7.
The Jenkins plugin ec2 launches and terminates EC2 instances acting as Jenkins agents automatically.
An Application Load Balancer (ALB) acts as the entry point for users and forwards the incoming request to the Jenkins controller. On top of that, the ALB terminates HTTPS and handles authentication.
The Cognito User Pool provides a secure way to authenticate with Jenkins. By the way, replacing the Cognito User Pool with any OpenID Connect compatible identity provider is possible.
An Elastic File System (EFS) is used to ensure no data is getting lost when replacing the Jenkins controller in case of a failure or rolling update.
Backup takes snapshots of EFS to be able to restore data from a point-in-time snapshot. For example, to recover from a human error.
All EC2 instances send metrics and logs to CloudWatch. Alarms notify operators in case of problems. Also, operators have access to centralized logs to analyze issues.
The Simple E-Mail Service allows Jenkins to send notifications to engineers. For example, to notify about failed jobs.
Engineers access EC2 instances using the Sytems Manager Session Manager in a very secure manner. The Session Manager replaces SSH and, therefore, publicly accessible inbound ports.
To set up an auto-scaling group for Jenkins in AWS, follow these steps:
Launch an EC2 instance for Jenkins in your preferred region.
Install Jenkins and any necessary plugins on the instance.
Create an Amazon Machine Image (AMI) of the Jenkins instance, which will be used to launch new instances in the auto-scaling group.
Create an IAM role that allows the auto-scaling group to launch and terminate instances and access other AWS resources such as S3 buckets or RDS instances.
Create a launch configuration that includes the AMI and IAM role, as well as any additional configurations such as instance type and security group settings.
Configure the auto-scaling group with the launch configuration, specifying the desired minimum and a maximum number of instances to be running at any given time.
Optionally, set up a load balancer to distribute traffic among the instances in the auto-scaling group.
Here are more detailed instructions:
Launch an EC2 instance for Jenkins in your preferred region:
Go to the EC2 console in the AWS Management Console.
Click "Launch Instance" and select an Amazon Machine Image (AMI) for your instance.
Choose an instance type and configure any necessary settings such as storage, network, and security groups.
Launch the instance.
Install Jenkins and any necessary plugins on the instance:
Connect to the instance using SSH or Remote Desktop, depending on your operating system.
Follow the instructions to install Jenkins on the instance.
Install any necessary plugins.
Create an Amazon Machine Image (AMI) of the Jenkins instance:
In the EC2 console, select the Jenkins instance.
Right-click on the instance and select "Create Image".
Give the image a name and description, and choose whether to reboot the instance before creating the image.
Click "Create Image" to create the image.
Create an IAM role:
In the IAM console, click "Roles" and then "Create Role".
Select "AWS service" as the type of trusted entity and choose "EC2" as the service that will use the role.
Attach a policy that allows the role to launch and terminate instances, and access any other necessary AWS resources.
Give the role a name and description.
Create a launch configuration:
In the EC2 console, go to the "Auto Scaling Groups" page and click "Create Launch Configuration".
Choose the AMI you created earlier.
Select the IAM role you created earlier.
Choose the instance type, storage, and other settings for the instances in the auto-scaling group.
Configure any necessary security groups and other settings.
Review and create the launch configuration.
Configure the auto-scaling group:
In the "Auto Scaling Groups" page, click "Create Auto Scaling Group".
Choose the launch configuration you created earlier.
Specify the minimum and maximum number of instances you want in the auto-scaling group.
Choose the VPC and subnets where the instances will be launched.
Configure any necessary scaling policies and notifications.
Review and create the auto-scaling group.
Optionally set up a load balancer:
In the EC2 console, go to the "Load Balancers" page and click "Create Load Balancer".
Choose the type of load balancer you want to create and configure it according to your needs.
Add the instances in the auto-scaling group to the load balancer's target group.
Update your DNS settings to point to the load balancer's DNS name.

Another way to manage Jenkins scalability is with EC2 (Amazon Elastic Compute Cloud) containers and the EC2 Fleet plugin.
This option suits teams that:
Though AWS comes at a cost, your financial limits are set at an account level.
Sign up for AWS if you don’t have an account
or
Log into your account if you already have access.
Start by creating a policy to allow access to use AWS EC2 Spot Fleet and the Auto Scaling Group:
Click the Services menu at the top, select Security, Identity, & Compliance then IAM.
Click Policies from the left menu under the Access Management heading.
Click Create Policy from the right.
Create a new policy with the visual editor to use both EC2 Spot Fleet and Auto Scaling Group. Alternatively, use the JSON editor and paste in the code from the plugin’s setup guide.
Click Next: tags.
Add tags if needed then click Next: Review.
Give the policy a name and description and click Create policy.
Now you create a user with the programmatic access and assign the new policy to it:
Click the Services menu at the top, select Security, Identity, & Compliance and then IAM.
Click Users from the left menu under the Access Management heading.
Click Add Users from the right.
Give your account a suitable name, select Access key – Programmatic access and click Next: Permissions.
Click the Attach existing policies directly button. Search for the policy you created in the previous step, tick the checkbox to the left and click Next: Tags.
Add tags if needed then click Next: Review.
Review your new user and click Create user.
Next, you create both authentication methods needed to connect AWS to Jenkins.
First, set an access key ID for your newly created IAM user. This will allow Jenkins to see information related to your AWS setup. To set the access key ID:
Click the Services menu at the top, select Security, Identity, & Compliance and then IAM.
Click Users from the left menu under the Access Management heading.
Search for and click the IAM user you created in step 2.
Go to the Security credentials tab and click Create access key.
Make a note of both the access key ID and the secret access key (click show to see it) and keep it somewhere safe, such as a password manager. You can only see the secret access key at this stage, and you’ll need to create a new one if you lose it.
Now you create a key pair. This allows Jenkins to connect to the instances that AWS will create when scaling. To set a key pair:
Click the Services menu at the top, select Compute and click EC2.
Click Key Pairs in the left menu under the Network & Security heading.
Click Create key pair.
Complete the following options and click Create key pair:
Name – give the key pair a descriptive name.
Key pair type - leave as RSA.
Private key file format – select .pem.
Tags – add if needed.
The private key will automatically download in a text file. Keep this file safe, you need it later.
You can either create an EC2 Spot Fleet or an Auto Scaling Group. In this example, we created an EC2 Spot Fleet, but check the AWS documentation if you want more info about creating Auto Scaling Groups.
Before starting, you should also have a clear idea about what Amazon Machine Image (AMI) you want to use. An AMI is a pre-built image that includes the operating system and software your EC2 Fleet will create extra machines from.
Your AMI image should include Java 11 as Jenkins won’t scale without it. We use the OpenJDK 11 Java 11 Ubuntu 18.04 AMI from the AWS Marketplace, however, you could build your own if you need something specific. See AWS’s documentation for more information on AMIs.
To create an EC2 Spot Fleet:
Click the Services menu at the top, select Compute and click EC2.
Click Spot Requests from the left menu under the Instances heading.
Click Request Spot Instances.
Set the following options at a minimum – the others you can change as you need:
AMI – remember to select an AMI that includes Java 11.
Key pair name – select the key pair name we created in step 3.
Maintain target capacity – check this box.
Scroll to the bottom and click Launch when finished.
It takes a few moments for AWS to create your fleet. Then you can configure Jenkins.
To install the EC2 Fleet plugin:
Click Manage Jenkins from the menu.
Click Manage Plugins.
Click the Available tab and start typing EC2 Fleet into the Filter field. The plugin should appear in the predicted search results.
Check the tick box to the left of the plugin then click Install without restarting.
Jenkins will install the plugin and all dependencies, including other plugins, extensions, and Amazon Software Development Kits (SDKs).
If you haven’t already, you should also install the Credentials Binding plugin.
To add your AWS IAM account:
Click Manage Jenkins from the menu.
Scroll down to the Security heading and click Manage Credentials.
Click Jenkins under the Stores scoped to Jenkins heading.
Click Global credentials (unrestricted) under the System heading.
If no credentials exist, you can click the How about adding some credentials? link, otherwise click Add Credentials from the left.
Complete the following fields and click OK:
Kind – Select AWS Credentials from the dropdown.
ID – Give the credentials a name you’ll use to identify the credentials in Jenkins.
Description – Enter a meaningful description.
Access Key ID – Enter the Access Key ID from when you created the IAM account in AWS.
Secret Access Key – Enter the access string from when you created the IAM account in AWS.
To add your key pair:
Click Manage Jenkins from the menu.
Scroll down to the Security heading and click Manage Credentials.
Click Jenkins under the Stores scoped to Jenkins heading.
Click Global credentials (unrestricted) under the System heading.
Click Add Credentials from the left.
Complete the following fields and click OK:
Kind – Select SSH Username with the private key from the dropdown.
ID – Give the credentials a name you’ll use to identify the credentials in Jenkins.
Description – Enter a meaningful description.
Username – This username is for the AMI you selected.
Private Key – Check the Enter directly radio button, click the Add button, and paste in the contents of the key pair file you downloaded earlier.
Now you connect Jenkins to the AWS EC2 Spot Fleet:

Click Manage Jenkins from the menu.
Click Manage Nodes and Clouds.
Click Configure Clouds.
Select Amazon EC2 Fleet from the Add a new cloud dropdown. Complete the following fields and click Save:
Name – Enter a descriptive name for use in Jenkins.
AWS Credentials – Select your Access Key ID from the AWS Credentials dropdown.
Region – Select your fleet’s EC2 fleet’s region from the dropdown.
EC2 Fleet – Any EC2 Spot Fleets connected to your Access Key ID will appear here. You may need to click Test Connection if the credentials aren’t showing.
Launcher – Select Launch agents via SSH, select the key pair credentials you added in Step 2 and Non-verifying Verification Strategy from both new dropdown boxes.
After a few minutes, go to your Jenkins dashboard. Under the Build Executor Status on the left, you should see both your controller instance and your new EC2 Fleet. If the EC2 fleet is showing any errors, click its name to see logs to identify the problem.
To test that Jenkins will now scale suitably, you can create simple build jobs to check how they’re distributed.
First, you want to set Jenkins so it won’t run jobs on the controller (unless you tell it otherwise):
Click Manage Jenkins from the menu.
Click Configure System.
Select Only build jobs with label expressions matching this node from the Usage dropdown, then click Save.
Now create a “Hello World” build job:
Click New Item from the Jenkins dashboard.
Enter a suitable name, such as Testing, select Freestyle project and click OK.
Under the Build heading, select Execute shell from the dropdown box.
Enter echo "Hello World" into the Command box and click Save:
Run the build job and, if working correctly, you’ll see it appear under your fleet in the Build Executor Status on the left. Once complete, you can also check your build history to check exactly where the job ran.
After it's set up and working, you can change how you want Jenkins to scale in AWS.
Log into AWS.
Click the Services menu at the top, select Compute and click EC2.
Click Spot Requests from the left menu under the Instances heading.
Click the Request ID of your EC2 Spot Fleet.
Scroll to the bottom of the page to see the scaling options. Click the Configure button under the Auto Scaling heading.
Change settings as you need and save.
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Checkout the below link for Day 18 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day18/tasks.md
Docker Compose is a tool that was developed to help define and share multi-container applications.
With Compose, we can create a YAML file to define the services and with a single command, can spin everything up or tear it all down.
To learn more about docker-compose visit here
YAML is a data serialization language that is often used for writing configuration files. Depending on whom you ask, YAML stands for yet another markup language or YAML ain’t markup language (a recursive acronym), which emphasizes that YAML is for data, not documents.
YAML is a popular programming language because it is human-readable and easy to understand.
YAML files use a .yml or .yaml extension.
Read more about it here
Learn how to use the docker-compose.yml file, to set up the environment, configure the services and links between different containers, and also to use environment variables in the docker-compose.yml file.
Docker Compose is a tool for defining and running multi-container Docker applications. It allows you to define your application as a set of services, each with its own container, and specify how these containers should interact with each other.
With Docker Compose, you can define your application’s infrastructure, including databases, message queues, and web servers, in a simple YAML file.
Docker Compose provides a simple way to orchestrate and manage the containers that make up your application, allowing you to start and stop them together, scale them up and down as needed, and manage their network connections.
This makes it easier to develop, test, and deploy complex applications that consist of multiple services.


So now we will see all the things written in the docker-compose file.
version: 3.8 denotes that we are using version 3.8 of Docker Compose.
The service informs us about the various containers the compose file is going to create in this case three will be created as we have three services: web, PHP and mysqldb.
The image keyword is used to specify the image from the docker hub for MYSQL containers, Ngnix and Php
For all three services, we are using different ports and using the port keyword to mention the ports that need to expose for those services.
And then, we also specify the environment variables for MySQL which are required to run MySQL.
The docker-compose-up command is used to start up a set of containers defined in a Docker Compose file.
By default, docker-compose up starts containers in the foreground and logs their output to the console. You can use the -d flag to start the containers in detached mode, which runs them in the background.
The docker-compose ps command is used to display the status of containers defined in a Docker Compose file.



Run the container as a non-root user (Hint- Use usermod command to give the user permission to docker).

Then reboot the instance after permitting the user.

Inspect the container’s running processes and exposed ports using the docker inspect command.
docker inspect <container_name or ID>
docker logs <container_name or ID>
docker stop <container-name or ID>
docker start <container-name or ID>
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Storing code and other artefacts into a repository backed by a version control system (VCS) is a fairly well-understood and agreed-upon technique. However, many organizations I work with are still creating and managing repositories by hand or with one-off scripts. While this method does work and is often good for beginners to get a grasp on the fundamentals, there are tough challenges with scale, consistency, security, and cleanup to surmount. It is far more powerful to use code to deploy, secure, and manage repositories.
still creating Github repositories the old-school way (manual), with following steps:
Log into your Github account
Click on “+” (New Repository)
Manually type repo name, permission
Manually add license, readme, and gitignore file
Save and create the new repo
Start adding basic project structures in the new repo
so this step is so much inefficient, error-prone, has no standardization, is and not scalable.

This article will show you how to create a GitHub repository in a more IAC (Infra as code) fashion, which is more efficient and scalable.
HashiCorp Terraform is a tool for building, changing, and versioning infrastructure that has an open-source and enterprise version. Terraform is platform agnostic and can be used to create cross-platform infrastructure. Terraform provides thousands of integrations for different platforms, tools, networking, logging, monitoring, etc.
![What is Terraform Cloud? Complete Terraform Tutorial [New]](https://www.whizlabs.com/blog/wp-content/uploads/2021/04/Terraform-1.png)
Prerequisites:
You have Terraform installed locally

You have an existing Github account

You have generated a personal access token with at least full repo control permissions


->Validate and fix formatting
$ terraform validate
$ terraform fmt
->Dry run and plan
$ terraform plan Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ createTerraform will perform the following actions:# github_repository.terraform will be created
+ resource "github_repository" "terraform" {
+ allow_merge_commit = true
+ allow_rebase_merge = true
+ allow_squash_merge = true
+ archived = false
+ default_branch = (known after apply)
+ delete_branch_on_merge = false
....
-> Execute
$ terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ createTerraform will perform the following actions:# github_repository.terraform will be created
+ resource "github_repository" "terraform" {
+ allow_merge_commit = true
+ allow_rebase_merge = true
+ allow_squash_merge = true
+ archived = false
+ default_branch = (known after apply)
+ delete_branch_on_merge = false
+ description = "terraform from Terraform"
+ etag = (known after apply)
+ full_name = (known after apply)
+ git_clone_url = (known after apply)
...
Plan: 1 to add, 0 to change, 0 to destroy.Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.Enter a value: yes github_repository.terraform: Creating...
github_repository.terraform: Creation complete after 6s [id=terraform]Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Now you should have your new repo in your GitHub account
So, this is how you create a GitHub repository using Terraform and the concept of IAC. It might take you some time initially to set up the templates and develop the terraform code.

If you want to delete the repo, just simply type terraform destroy and it will do the deletion for you.
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Checkout the below link for Day 17 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day17/tasks.md
For this, you first need an AWS EC2 instance of your own choice.
Here is my blog on creating an AWS EC2 instance :
Checkout the below link for Provisioning your first EC2 Instance
https://progressivecoder.com/step-by-step-process-to-launch-aws-ec2-instance/
Once you are done with creating an EC2 instance you need to SSH into it.
Now you need to install the docker Engine in your server. Checkout the below link
https://www.zehncloud.com/how-to-install-docker-on-amazon-ec2-instance/
Below are the steps that we will be going to perform in the process:
Install Git and clone the repo of the react-python Django web application
Install Docker
Create and configure a Dockerfile
Build a Docker image
Create and run a Docker container
Access it
Open the instance, first, you need to install Git in it so that we can clone the application repository from GitHub(VCS). Use command :
sudo apt install git
git clone https://github.com/sandhya261996/react_django_demo_app.git


Install Docker in the machine using the command :
sudo apt install docker -y

Now check the version of the docker and start the docker and check the status of the docker to know if it is running using the below commands :
docker -v
systemctl start docker
systemctl status docker

Now we will create and configure a docker file as per the requirement of the Node.js application. Change the directory to the cloned project and create Dockerfile there.
FROM python:3.9
WORKDIR app
COPY . /app
RUN pip install -r requirements.txt
EXPOSE 8000
CMD ["python", "manage.py","runserver","0.0.0.0:8000"]

Now before starting the build process check if there is any existing container running with the same name.
sudo docker ps
sudo docker ps -a

Using the image that has been built we will create a container out of it and run it:
Use the below commands :
sudo docker run -d --name python-django-app -p 8000:8000 django_app:latest
You can see a container running here that can be accessed on port 8000 as we have done the port mapping on port 8000.
Now you can take the public IP of the machine and port 8000 to access the application.

We have already created a Docker image using the Dockerfile. Check all the images present by using the command.
sudo docker images
Now we will log in in to the DockerHub by adding the command:
sudo Docker login
Put your username and password here. If the login is successful, then you will get a message like Login Succeeded.

Now tag the locally created image to the docker hub. This means we have to tag the image with the docker hub username.
sudo docker tag django_app:latest sandhyakumari1996/django_app:latest

Now push the image to the Docker hub using the push command.
sudo docker push sandhyakumari1996/djnago_app:latest

When it is done, you can check in your Docker hub if it is pushed.

Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Checkout the below link for Day 16 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day16/tasks.md

Docker is a software platform that allows you to build, test, and deploy applications quickly. Docker packages software into standardized units called containers that have everything the software needs to run including libraries, system tools, code, and runtime. Using Docker, you can quickly deploy and scale applications into any environment and know your code will run.
Install Docker on your server first.
Checkout the below link for docker installation:
https://docs.docker.com/engine/install/ubuntu/
1.) Use the docker pull command to pull the image from the docker hub.

Then we used the docker run command to run a container in detached mode using the pulled image.
2.)To create a container with a container name:
1.)without a port map
command — docker run -d — name <container-name> <image-name>
2.)with a port map
command — docker run -p — name <container-name> <image-name>

docker inspect command to view detailed information about a container or image. 
4.) Use the docker port command to list the port mappings for a container.
docker port is a Docker command that displays the public-facing port(s) of a running container.
docker port <container name>

5.)Use the docker stats command to view resource usage statistics for one or more containers.
docker stats is a Docker command that displays real-time usage statistics for running containers.
docker stats [OPTIONS] [CONTAINER...]
Options:
— no-stream: Disable streaming stats and only pull the first result
— no-trunc: Do not truncate output
— all , -a: Show all containers (default shows just running)
— format: Pretty print images using a Go template
6.) Use the docker top command to view the processes running inside a container.
docker top is a Docker command that shows the processes running inside a container.
The output of the docker top command includes the process ID, user, CPU usage, memory usage, and command that is being executed by each process.
docker top <container name>

docker load command to load an image from a tar archive. docker load is a Docker command that loads one or more Docker images from a tar archive.
docker load [OPTIONS] < myimages.tar

docker save command to save an image to a tar archive. docker save is a Docker command that saves one or more Docker images to a tar archive.
docker save [OPTIONS] IMAGE [IMAGE…]

Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>
Checkout the below link for Day 15 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day15/tasks.md
As a DevOps Engineer, you should be able to parse files, be it txt, json, yaml, etc.
You should know what libraries one should use in Python for DevOps.
Python has numerous libraries like os, sys, json, yaml etc that a DevOps Engineer uses in day-to-day tasks.
Create a Dictionary in Python and write it to a json File.
JSON stands for JavaScript Object Notation. It means that a script (executable) file which is made of text in a programming language, is used to store and transfer the data.

Function Used:
json.dumps()
json.dump()
Here we will be using json.dumps()

OUTPUT:

Read a JSON file services.json kept in this folder and print the service names of every cloud service provider.
output:
aws: ec2 azure: VM gcp: compute engine

OUTPUT:

Here we first read the JSON file, on the left side of the image, kept in this folder and parse by using the loads() function then we print this file data by print function.
Read the YAML file using python, file services. yaml and read the contents to convert YAML to JSON.
PyYAML is a YAML parser and emitter for Python.
To install pyYAML module use command.
We need to use PyYAML module’s yaml.load() function. This function parses and converts a YAML object to a Python dictionary (dict object).
This process is known as Deserializing YAML into a Python.
First, we write the file data to the Yaml file using the dump() function & Then we fetch all data from Yaml by using the safe_load function.
File data is available in the YAML file as we see on the left side of the image.


Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>what is docker?
Why docker is so popular?
what is a docker image?
What is a docker Hub?
what are containers?
what is a docker file?
what is VM(Virtual Machine)?
when you should not use Docker or containers?
Extremely Useful Docker Commands?
Docker is a new technology that allows development teams to build, manage, and secure apps anywhere.
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly.
With Docker, you can manage your infrastructure in the same ways you manage your applications.
By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.
Docker is lightweight, portable, and self-contained.
Docker containers improve software development, application deployment, and business agility.
Docker is popular because of the possibilities it opens for software delivery and deployment. Many common problems and inefficiencies are resolved with docker containers.
The six main reasons for Docker’s popularity are:
A large part of Docker’s popularity is how easy it is to use. Docker can be learned quickly, mainly due to the many resources available to learn how to create and manage containers. Docker is open-source, so all you need to get started is a computer with an operating system that supports Virtualbox, Docker for Mac/Windows, or supports containers natively, such as Linux.
Containers allow much more work to be done with far less computing hardware. In the early days of the Internet, the only way to scale a website was to buy or lease more servers. The cost of popularity was bound, linearly, to the cost of scaling up. Popular sites became victims of their success, shelling out tens of thousands of dollars for new hardware. Containers allow data centre operators to cram far more workloads into less hardware. Shared hardware means lower costs. Operators can bank those profits or pass the savings along to their customers.
Software delivery using containers can also be more efficient. Containers are portable. They are also entirely self-contained. Containers include an isolated disk volume. That volume goes with the container as it is developed and deployed to various environments. The software dependencies (libraries, runtimes, etc.) ship with the container. If a container works on your machine, it will run the same way in a Development, Staging, and Production environment. Containers can eliminate the configuration variance problems common when deploying binaries or raw code.
Operating containerized applications is more flexible and resilient than that non-containerized applications. Container orchestrators handle the running and monitoring of hundreds or thousands of containers.
Container orchestrators are very powerful tools for managing large deployments and complex systems. Perhaps the only thing more popular than Docker right now is Kubernetes, currently the most popular container orchestrator.
Docker supports software-defined networking. The Docker CLI and Engine allow operators to define isolated networks for containers, without having to touch a single router. Developers and operators can design systems with complex network topologies and define the networks in configuration files. This is a security benefit, as well. An application’s containers can run in an isolated virtual network, with tightly-controlled ingress and egress paths.
The rise of microservices has also contributed to the popularity of Docker. Microservices are simple functions, usually accessed via HTTP/HTTPS, that do one thing — and do it well.
Software systems typically start as “monoliths,” in which a single binary supports many different system functions. As they grow, monoliths can become difficult to maintain and deploy. Microservices break a system down into simpler functions that can be deployed independently. Containers are terrific hosts for microservices. They are self-contained, easily deployed, and efficient.

A Docker image is a lightweight, stand-alone, executable package that includes everything needed to run a piece of software, including the application code, libraries, dependencies, and runtime.
Images are created using the docker build command and are stored in a Docker registry, such as Docker Hub.
A Docker container is a running instance of a Docker image. You can create a container from an image using the docker run (image name)command. When you start a container, Docker creates a new runtime environment, which includes a copy of the files in the image, and runs the application inside the container.
You can create multiple containers from the same image, and they will all contain the same application code and dependencies. Each container is an isolated environment, and the applications running in different containers do not interfere with each other.
This makes it easy to scale up or down the number of containers running an application, depending on demand.
A docker image is a template for creating containers, and a Docker container is a running instance of a Docker image.

Docker Hub is a cloud-based repository in which Docker users and partners create, test, store and distribute container images.
We can use Docker Hub to find pre-built images that you can use as the basis for your own containerized applications, or you can use it to build, test, and store your custom images.
It is a great resource for quickly and easily deploying containerized applications.
Docker Hub is a cloud-hosted version of the Docker Registry.
To push an image to Docker Hub :
Log into Docker Cloud with the (docker login) command.
Tag the specified image using the (docker tag) command**.**
Push the image to Docker Hub with (docker push).
Check Docker Cloud to ensure the image appears in her repository.
A user can pull an image from Docker Hub with the (docker pull) command.
Containers are a way to package software in a format that can run consistently across different environments.
This makes it easier to develop, test, and deploy applications because it eliminates the need to worry about differences in libraries or system configurations on different machines.
Containers allow you to package an application with all of its dependencies and ship it as a single unit.
This makes it easier to move the containerized application between different computing environments, such as from a developer’s laptop to a staging or production environment.
A container is a special type of process that is isolated from other processes. Containers are assigned resources that no other process can access, and they cannot access any resources not explicitly assigned to them.
Processes that are not “containerized” can ask the operating system for access to any file on disk or any network socket.
Until containers became widely available, there was no reliable, guaranteed way to isolate a process to its own set of resources. A properly functioning container has no way to reach outside its resource “sandbox” to touch resources that were not explicitly assigned to it.
For example, two containers running on the same computer might as well be on two completely different computers, miles away from each other. They are entirely and effectively isolated from each other.
This isolation has several advantages:
Two containerized processes can run side-by-side on the same computer, but they can’t interfere with each other.
They can’t access each other’s data unless explicitly configured to do so.
Two different applications can run containers on the same hardware with confidence that their processes and data are secure.
Shared hardware means less hardware. Gone are the days when a company needs thousands of servers to run applications. That hardware can be shared between different business units or entirely different enterprise clients. The result is massive new economies of scale for private and public centres alike.

A Dockerfile is a text file that contains instructions for how to build a Docker image.
It is used to automate the process of building a Docker image so that you don’t have to manually specify all the steps required to build the image.
A Dockerfile consists of a series of commands, each of which specifies a step in the process of building the image.
These commands can be used to specify things like the base image to use, the packages to install, the commands to run, and so on.
Most commonly used tags in a Dockerfile:
FROM: Specifies the base image to use for the image being built.
RUN: Executes a command during the build process.
CMD: Specifies the default command to run when the container is started.
ENV: Sets an environment variable in the container.
COPY: Copies files or directories from the host file system into the container.
EXPOSE: Exposes a specific port or port to be used by the container.
LABEL: Adds metadata to the image in the form of key-value pairs.
USER: Specifies the user to use when running the container.
WORKDIR: Sets the working directory for the container.

This Dockerfile specifies that it will use the python:3 image as the base image. The working directory will be /WORK_REPO.
And it will copy all the files at the current location in the container.
RUN shell command (mkdir and cd ).
It sets the default command for the container to hello_world.py.
To build an image from a Dockerfile, you can use the docker build command.
A virtual machine (VM) is an operating system (OS) or application environment that is installed on software, which imitates dedicated hardware. The end-user has the same experience on a VM as they would on dedicated hardware.
A virtual machine (VM) is a virtual environment that works like a computer within a computer. It runs on an isolated partition of its host computer with its own CPU power, memory, operating system (such as Windows, Linux, macOS), and other resources. End users can run applications on VMs and use them as they normally would on their workstations.
A VM provides an isolated environment for running its OS and applications independently from the underlying host system or from other VMs on that host. The VM's OS is commonly referred to as the guest OS, and it can be the same as or different from the host OS or the other VMs. In this way, a single computer can host multiple VMs, all running different OSes and applications, without affecting or interfering with each other. The VM is still dependent on the host's physical resources, but those resources are virtualized and distributed across the VMs and can be reassigned as necessary, making it possible to run different environments simultaneously, as well as accommodate fluctuating workloads.
checkout the below link for more understanding
https://www.freecodecamp.org/news/7-cases-when-not-to-use-docker/


I am going to list such common but essential Docker commands that are extremely useful for day-to-day use by Docker users and admins.
docker logs - Displays the logs of a running Docker container.
docker inspect - Returns low-level information on a Docker object (container, image, network, etc.)
docker network - Manages Docker networks.
docker volume - Manages Docker volumes.
docker-compose - Manages multi-container Docker applications.
docker rmi - Removes a Docker image.
docker version - Shows the current Docker version installed on the system.
docker info - Displays information about the current Docker installation and configuration.
docker run - Runs a Docker container.
docker ps - Lists the currently running Docker containers.
docker images - Lists the Docker images available on the system.
docker pull - Downloads a Docker image from a Docker registry.
docker push - Uploads a Docker image to a Docker registry.
docker build - Builds a Docker image from a Dockerfile.
docker tag - Tags a Docker image with a name that can be used for uploading to a Docker registry.
docker commit - Creates a new Docker image from a running container.
docker start - Starts a stopped Docker container.
docker stop - Stops a running Docker container.
docker restart - Restarts a running Docker container.
docker rm - Removes a stopped Docker container.
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Checkout the below link for Day 14 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day14/tasks.md

Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data.
Since everything is an object in Python programming, data types are actually classes and variables are instances (objects) of these classes.
Python has the following data types built-in by default: Numeric(Integer, complex, float), Sequential(string,lists, tuples), Boolean, Set, Dictionaries, etc
Data Structures are a way of organizing data so that it can be accessed more efficiently depending on the situation. Data Structures are fundamentals of any programming language around which a program is built. Python helps to learn the fundamental of these data structures more simply as compared to other programming languages.
Lists Python Lists are just like arrays, declared in other languages which is an ordered collection of data. It is very flexible as the items in a list do not need to be of the same type
Tuple Python Tuple is a collection of Python objects much like a list but Tuples are immutable i.e. the elements in the tuple cannot be added or removed once created. Just like a List, a Tuple can also contain elements of various types.
Dictionary Python dictionary is like hash tables in any other language with the time complexity of O(1). It is an unordered collection of data values, used to store data values like a map, which, unlike other Data Types that hold only a single value as an element, a Dictionary holds the key: value pair. Key-value is provided in the dictionary to make it more optimized



List example

tuple example

Create the below Dictionary and use Dictionary methods to print your favourite tool just by using the keys of the Dictionary.

2. Create a List of cloud service providers eg.


3. Write a program to add Digital Ocean to the list of cloud_providers and sort the list in alphabetical order.

Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Checkout the below link for Day 12 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day11/tasks.md
Git stash is a command that allows you to temporarily save changes you have made in your working directory, without committing them. This is useful when you need to switch to a different branch to work on something else, but you don’t want to commit the changes you’ve made in your current branch yet.

To use Git stash, you first create a new branch and make some changes to it. Then you can use the command git stash to save those changes. This will remove the changes from your working directory and record them in a new stash. You can apply these changes later. git stash list command shows the list of stashed changes.
You can also use git stash drop to delete a stash and git stash clear to delete all the stashes.
Git cherry-pick is a command that allows you to select specific commits from one branch and apply them to another. This can be useful when you want to selectively apply changes that were made in one branch to another.

To use git cherry-pick, you first create two new branches and make some commits to them. Then you use the git cherry-pick <commit_hash> command to select the specific commits from one branch and apply them to the other.
Conflicts can occur when you merge or rebase branches that have diverged, and you need to manually resolve the conflicts before it can proceed with the merge/rebase. git status command shows the files that have conflicts, the git diff command shows the difference between the conflicting versions and the git add command is used to add the resolved files.

Create a new branch and make some changes to it.
Use git stash to save the changes without committing them.
Switch to a different branch, make some changes and commit them.


In version01.txt of development, the branch adds the below lines after “This is the bug fix in development branch” that you added in Day10 and reverted to this commit.
Line2>> After bug fixing, this is the new feature with minor alterations”
Commit this with the message “ Added feature2.1 in development branch”


Line3>> This is the advancement of the previous feature
Commit this with the message “ Added feature2.2 in development branch”

Line4>> Feature 2 is completed and ready for release
Commit this with the message “ Feature2 completed”

All these commits messages should be reflected in the Production branch too which will come out from the Master branch (Hint: try to rebase).

Task-03
• In Production branch Cherry pick Commit “Added feature2.2 in development branch” and added below lines in it:
• Line to be added after Line3>> This is the advancement of previous feature
• Line4>>Added few more changes to make it more optimized.
• Commit: Optimized the feature



After committing in main branch, switch to the different branch And run the cherry-pick command git cherry-pick


Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
Checkout the below link for Day 13 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day13/tasks.md
Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.
It is used for:
web development (server-side),
software development,
mathematics,
system scripting.
Python is a high-level, general-purpose programming language with an elegant syntax that allows programmers to focus more on problem-solving than on syntax errors. One of the primary goals of Python Developers is to keep it fun to use. Python has become a big buzz in the field of modern software development, infrastructure management, and especially in Data Science and Artificial Intelligence. Most recently, Python has risen to the top 3 list of the TIOBE index of language popularity. Python is becoming increasingly ubiquitous, but you must be wondering why Python has become such a hot topic in the developers’ world.
Python provides lots of features that are listed below.
Python is easy to learn and use compared with other programming languages. It is a developer-friendly and high-level programming language.
Python is an interpreted language because no need for compilation. This makes debugging easy and thus suitable for beginners.
Python can run equally on different platforms such as Windows, Linux, Unix and Macintosh etc. So, we can say that Python is a portable language.
The Python interpreter is developed under an open-source license, making it free to install, use, and distribute.
Python supports object-oriented language and concepts of classes and objects come into existence.
Graphical user interfaces can be developed using Python.
It can be easily integrated with languages like C, C++, JAVA etc.



Data types are the classification or categorization of data items. It represents the kind of value that tells what operations can be performed on a particular data. In Python, several built-in data types can be used to store and manipulate different types of data. The most common data types in Python are:
There are three types of numeric data types in Python: integers, floats, and complex numbers.
a = 66 integer
b = 6.14 float
c = 3 + 2j complex number
A string is a sequence of characters, enclosed in quotes (either single or double quotes).
a = ‘Hello, python!’ single quotes
b = “From today onward I am learning python.” double quotes
A Boolean data type is a binary data type that can have only two values, True or False.
a = True
b = False
A tuple is similar to a list, but it is immutable, meaning that its elements cannot be changed once it is created.
random_tuple = (16, ‘Mango’, 2.14, True)
A list is a collection of ordered and mutable elements that can be of different data types.
random_list = [16, ‘python’, 2.14, True]
A set is an unordered collection of unique elements.
unorder_set = {1, 2, 3, 4}
A dictionary is an unordered collection of key-value pairs, where each key is associated with a value.
unordered_dict = {‘name’: ‘python’, ‘age’: 1991, ‘place’: ‘Netherlands’}
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Checkout the below link for Day 11 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day12/tasks.md

Initialize a new Git repository: git init
Check the status of your repository: git status
Add changes to the staging area: git add <file> or git add. (to add all changes)
Commit changes: git commit -m "Commit message"
Push changes to a remote repository: git push <remote> <branch>
Pull changes from a remote repository: git pull <remote> <branch>
Create a new branch: git branch <branch name>
Switch to a different branch: git checkout <branch name>
Merge branches: git merge <branch to merge>
View commit history: git log
Undo local changes: git checkout -- <file>
Revert to a previous commit: git revert <commit hash>
Clone a remote repository: git clone <repository URL>
Reset to a specific commit: git reset <commit hash>
Delete a branch: git branch -d <branch name>
This is a basic list of Git commands.

Linux Cheat Sheet

ls – The most frequently used command in Linux to list directories
pwd – Print working directory command in Linux
cd – Linux command to navigate through directories
mkdir – Command used to create directories in Linux
mv – Move or rename files in Linux
cp – Similar usage as mv but for copying files in Linux
rm – Delete files or directories
touch – Create blank/empty files
ln – Create symbolic links (shortcuts) to other files
cat – Display file contents on the terminal
clear – Clear the terminal display
echo – Print any text that follows the command
less – Linux command to display paged outputs in the terminal
man – Access manual pages for all Linux commands
name – Linux command to get basic information about the OS
whoami – Get the active username
tar – Command to extract and compress files in Linux
grep – Search for a string within an output.
head – Return the specified number of lines from the top
tail – Return the specified number of lines from the bottom
diff – Find the difference between two files
CMP – Allows you to check if two files are identical
comm – Combines the functionality of diff and cmp
sort – Linux command to sort the content of a file while outputting
export – Export environment variables in Linux.
zip – Zip files in Linux
unzip – Unzip files in Linux
ssh – Secure Shell command in Linux
service – Linux command to start and stop services
ps – Display active processes
kill and kill all – Kill active processes by process ID or name
df – Display disk filesystem information
mount – Mount file systems in Linux
chmod – command to change file permissions
chown – Command for granting ownership of files or folders
ifconfig – Display network interfaces and IP addresses
traceroute – Trace all the network hops to reach the destination
wget – Direct download files from the internet
apt, Pacman, yum, rpm – Package managers depending on the distro
sudo – Command to escalate privileges in Linux
ls -l - list
This is a basic list of linux commands.

Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
Checkout the below link for Day 10 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day10/tasks.md
Git branching is a feature in the Git version control system that allows developers to create multiple independent branches of their codebase, enabling them to work on different features or fixes simultaneously without affecting the main codebase.
Changes made to a branch can be merged back into the main codebase once they are complete and have been reviewed. Git branching is a powerful tool that allows developers to manage code changes more efficiently and collaboratively.
Git revert undoes a specific commit by creating a new commit that undoes the changes made by the original commit. This is a safe way to undo changes, as it does not change the commit history and allows you to easily undo the undo if needed.
Git reset, on the other hand, allows you to move the current branch to a specific commit, which can potentially change the commit history. It’s important to use reset with caution, as it can cause data loss and make it difficult to undo changes.
Git rebase is a command that allows you to apply the changes from one branch to another. This can be useful for keeping your branch up-to-date with changes made in a separate branch or for creating a linear history before merging your changes into the main branch.
Git merge is a command that allows you to combine the changes from two or more branches into a single branch. When you run git merge, Git will automatically try to merge the changes made in the source branch into the target branch.
If there are no conflicts between the changes, Git will create a new commit that includes all the changes from the merged branch. If there are conflicts, Git will prompt you to manually resolve them before the merge can be completed.
Merging is a common way to integrate changes from other branches into your working branch. It creates a new commit that represents the combination of changes.
Add a text file called version01.txt inside the Devops/Git/ with “This is the first feature of our application” written inside. This should be in a branch coming from master, [hint try git checkout -b dev], switch to the dev branch ( Make sure your commit message will reflect as "Added new feature"). [Hint use your knowledge of creating branches and Git commit command]
Add a new commit in dev branch after adding the below-mentioned content in Devops/Git/version01.txt: While writing the file make sure you write these lines
1st line>> This is the bug fix in the development branch
Commit this with the message “ Added feature2 in development branch”
2nd line>> This is gadbad code
Commit this with the message “ Added feature3 in the development branch
3rd line>> This feature will gadbad everything from now.
Commit with the message “ Added feature4 in the development branch




2. Create a new Branch “dev” and commit the changes


3. Use the git reset command to go back to the correct file. And after that switch to the main branch



4. Merge the dev branch to the main branch and push the changes to the remote Repository


5. Changes are Updated on Remote Repository

Demonstrate the concept of branches with 2 or more branches with a screenshot.
add some changes to dev branch and merge that branch in master
as a practice try git rebase too, and see what difference you get.



Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
Checkout the below link for Day 9 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day09/tasks.md
Git is a version-control system that is widely used for software development and other version-controlled projects. It is a distributed system, which means that the code and its full history are stored in many different places, so it is very difficult to lose data.
Git is important because it provides a way for multiple people to collaborate on a project and keep track of the changes made to the code over time. This makes it easier to maintain and develop software, especially for large projects. With Git, developers can work independently and submit their changes, which can then be easily merged with the main codebase.
Git also makes it easier to revert to an earlier version of the code if a mistake is made or if you need to return to a previous state for some other reason. Additionally, Git allows for easy experimentation and exploration, as you can switch between different versions of your code to see the impact of different changes.
In summary, Git is a powerful tool that helps software development teams to collaborate and manage changes to their code over time, making it an essential tool for many software projects.
In Git, the main branch is the default branch name that is usually used to represent the primary line of development. The “main” branch is intended to serve as the long-lived, stable branch, where the source code of a project is held.
The “master” branch, on the other hand, is a commonly used name for the main branch in many Git projects. The name “master” originated from the days when Git was mostly used for version control of software code, and the “master” branch represented the latest version of the code that was considered production-ready.
So to summarize, both “main” and “master” refer to the primary line of development in a Git repository, but “main” is a more recent term that is used to avoid potentially problematic language.
| Basis | Git | GitHub |
| Production | Git was first introduced in April 2005. | GitHub was first introduced in October 2007. The site was later developed in April 2008. |
| Owned by | Git is maintained by Linux | Is maintained by Microsoft. |
| Application | Git is a Command-Line tool. | GitHub is a Graphical User Interface. |
| Storage | Is installed locally in the system for use and does not require the internet. | Can be accessed on the web. It needs an internet connection. |
| Function | Majorly focused on version control and code conserving. | Is majorly focused on web hosting and code sharing. |
| User Preferences | Lacks user management features | GitHub has built-in user management features. It also provides Organisational and Enterprise level accounts with unlimited public repositories and collaborators. |
| Integrations | Provides no external tool configuration. | GitHub provides multiple external tools including third-party tools. |
| Availability | Git is an open-source that allows users to modify and share software. | GitHub is inclusive of free-tier and paid-tier versions. However, it is not open source. |
| Security | The privacy in Git is too strong | Privacy depends on the settings of the repositories. |
| Platform | It is compatible with Windows, macOS, Linux, Solaris, AIX | It is compatible with Windows, macOS, Linux, and all other web browsers. |
| Competitors | Although GIT is one of the best version controllers, it fights with Mercurial, IBM, etc. | Major competitors include GitLab, BITBUCKET, etc. |
| Communication/Issue Management | There’s no dedicated system to communicate with collaborators. | GitHub provides a specific tab to communicate and resolve issues with collaborators. |
To create a new repository on GitHub, follow these steps:
Go to the GitHub website and log in to your account.
Click the “+” icon in the top right corner of the screen and select “New repository”.
Enter a name for your repository in the “Repository name” field.
Optionally, you can add a description of your repository in the “Description” field.
Select whether you want your repository to be public or private. Public repositories are visible to anyone and can be cloned or forked by anyone, while private repositories are only accessible to you and other people you specifically invite.
Choose a license for your repository.
Click the “Create repository” button.
Once you have created your repository, you can add files, make changes, and share your code with others. You can also set up a Git repository on your local machine and push your changes to GitHub so that you can keep track of your code and collaborate with others.


In Git, a local repository is a copy of a project that is stored on your computer. You can make changes to the code in your local repository, commit those changes, and manage the history of your project without an internet connection.
A remote repository, on the other hand, is a version of your project that is stored on a server and is accessible from anywhere with an internet connection. Remote repositories are typically used for collaboration and sharing code with others.
To connect a local repository to a remote repository, you need to use the “git remote” command. Here are the basic steps to connect a local repository to a remote repository:
Initialize a Git repository in your local directory by running the “git init” command.
Go to GitHub and create a new remote repository for your project.
Copy the URL of the remote repository to your clipboard.
In your local repository, run the following command to add the remote repository:
git remote add origin <remote repository URL>
Replace “<remote repository URL>” with the URL of the remote repository.
5. To push your local repository to the remote repository, run the following command:
git push -u origin master
This command pushes the “master” branch of your local repository to the “origin” remote repository and sets the “origin” remote as the default remote for future pushes.
Create a repository named “Devops” on GitHub


Create a new file in Devops/Git/Day-02.txt & add some content to it
Push your local commits to the repository on GitHub

Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
Checkout the below link for Day 8 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day08/tasks.md
Git is a distributed version control system for software development. Git allows multiple people to collaborate on a project by keeping track of changes made to the codebase, making it easier to merge the changes made by different people and keep a clear history of changes.
With Git, developers can work on the same project from different locations and keep their own copies of the project, which are called “repositories”. When a developer makes changes to the code, they can “commit” the changes to their local repository and “push” the changes to a central repository that is shared by the rest of the team.
This makes it possible for everyone to have access to the latest version of the code at all times.
GitHub is a web-based platform that offers version control hosting for software development. It is built on top of Git and provides a user-friendly interface for developers to manage their Git repositories. With GitHub, developers can store their code, track changes, and collaborate with others on projects.
What is Version Control? How many types of version controls do we have?**
Version control is a system that records changes to a file or set of files over time, allowing developers to recall specific versions later. The main purpose of version control is to allow multiple people to work on a project simultaneously and to keep a history of changes that have been made to the codebase. This makes it easier to collaborate on a project, revert to previous versions of the code, and track the history of the development of a project.
There are two main types of version control systems: centralized version control systems and decentralized (or distributed) version control systems.
A centralized version control system (CVCS) uses a central server to store all the versions of a project’s files. Developers “check out” files from the central server, make changes, and then “check-in” the updated files. Examples of CVCS include Subversion and Perforce.
A distributed version control system (DVCS) allows developers to “clone” an entire repository, including the entire version history of the project. This means that they have a complete local copy of the repository, including all branches and past versions. Developers can work independently and then later merge their changes back into the main repository. Examples of DVCS include Git, Mercurial, and Darcs
Better collaboration: In a DVCS, every developer has a full copy of the repository, including the entire history of all changes. This makes it easier for developers to work together, as they don’t have to constantly communicate with a central server to commit their changes or to see the changes made by others.
Improved speed: Because developers have a local copy of the repository, they can commit their changes and perform other version control actions faster, as they don’t have to communicate with a central server.
Greater flexibility: With a DVCS, developers can work offline and commit their changes later when they do have an internet connection. They can also choose to share their changes with only a subset of the team, rather than pushing all of their changes to a central server.
Enhanced security: In a DVCS, the repository history is stored on multiple servers and computers, which makes it more resistant to data loss. If the central server in a CVCS goes down or the repository becomes corrupted, it can be difficult to recover the lost data.
Overall, the decentralized nature of a DVCS allows for greater collaboration, flexibility, and security, making it a popular choice for many teams.
step 1

step 2

step 3

step 4
Now we will clone it locally.

The clone is successful.
Now check the status of the repo.
#git status: check the status of the repo.

Now we will use the below command
#git add: to bring the file to staging

#git commit: command to save your changes to the local repository and add a meaningful message.

git commit –m “new hello.py file added”
#git remote –v: command to check available remote URL

If no available URL is present, then add a remote URL git remote add origin.
#git remote add origin https://github.com/sandhya261996/devOpschallenge.git
Now push the new file to GitHub.


Deleting the file from the local and restoring the same.
The “git restore” command is used to restore changes in a Git repository to a previous state
#git restore filename

Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>Checkout the below link for Day 7 task:
https://github.com/LondheShubham153/90DaysOfDevOps/blob/master/2023/day07/tasks.md
A package management system or package manager is a group of software tools. It automates the installation process, upgrading process, configuration process, and removal process of the computer programs for an operating system of the computer in an efficient manner.
In simpler words, a package manager is a tool that allows users to install, remove, upgrade, configure and manage software packages on an operating system. The package manager can be a graphical application like a software centre or a command lines tool like apt-get, YUM or Pacman.
A package is usually referred to as an application but it could be a GUI application, command line tool or a software library (required by other software programs). A package is essentially an archive file containing the binary executable, configuration file and sometimes information about the dependencies.
In the older days, software used to installed from its source code. You would refer to a file (usually named readme) and see what software components it needs, and the location of binaries. A configure script or makefile is often included. You will have to compile the software on your own along with handling all the dependencies (some software require installation of other software) on your own.
To get rid of this complexity, Linux distributions created their own packaging format to provide the end users with ready-to-use binary files (precompiled software) for installing software along with some metadata (version number, description) and dependencies.
It is like baking a cake versus buying a cake.
Package Managers differ based on the packaging system but the same packaging system may have more than one package manager.
For example, RPM has Yum and DNF, package managers. For DEB, you have apt-get, aptitude command line-based package managers.

1. Open the terminal on Ubuntu.
2. Remove any Docker files that are running in the system, using the following command:
$ sudo apt-get remove docker docker-engine docker.io |
After entering the above command, you will need to enter the password of the root and press enter.
3. Check if the system is up-to-date using the following command:
$ sudo apt-get update |
4. Install Docker using the following command:
$ sudo apt install docker.io |
You’ll then get a prompt asking you to choose between y/n - choose y
5. Install all the dependency packages using the following command:
$ sudo snap install docker |
6. Before testing Docker, check the version installed using the following command:
$ docker --version |
7. Pull an image from the Docker hub using the following command:
$ sudo docker run hello-world |
Here, hello-world is the docker image present on the Docker hub.
8. Check if the docker image has been pulled and is present in your system using the following command:
$ sudo docker images |
9. To display all the containers pulled, use the following command:
$ sudo docker ps -a |
10. To check for containers in a running state, use the following command:
$ sudo docker ps |
You’ve just successfully installed Docker on Ubuntu!

Jenkins requires the Java Runtime Environment (JRE). This guide uses OpenJDK for the Java environment. OpenJDK is a Development Kit and includes the Java Runtime Environment.
Follow the steps below to install Java on Ubuntu:
1. Check if you already have Java installed on your Ubuntu system:
java --version

Since Java is not installed on our system, we will install it using OpenJDK.
2. First, open a terminal and update the system package repository by running:
sudo apt update
3. Depending on which Java version you want to install, Java 8 or 11, run one of the following commands:
To install OpenJDK 11, run:
sudo apt install openjdk-11-jdk -y
We install OpenJDK version 11 on our system:

1. Start by importing the GPG key. The GPG key verifies package integrity but there is no output. Run:
curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
2. Add the Jenkins software repository to the source list and provide the authentication key:
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/ | sudo tee /etc/apt/sources.list.d/Jenkins.list > /dev/null
The command adds the Long Term Support (LTS) stable release to the sources list, but there is no output.
After setting up the prerequisites, follow the steps below to install Jenkins on Ubuntu:
1. Update the system repository one more time. Updating refreshes the cache and makes the system aware of the new Jenkins repository.
sudo apt update
2. Install Jenkins by running:
sudo apt install Jenkins -y
Wait for the download and installation to complete.

3. To check if Jenkins is installed and running, run the following command:
sudo systemctl status Jenkins
A bright green entry labelled active (running) should appear in the output, indicating that the service is running.

4. Exit the status screen by pressing Ctrl+Z.
The systemctl command is a utility that is responsible for examining and controlling the systemd system and service manager. It is a collection of system management libraries, utilities and daemons that function as a successor to the System V init daemon.
The new systemctl commands have proven quite useful in managing a servers services. It provides detailed information about specific systemd services, and others that have server-wide utilization.
It provides various commands to start, stop, restart, enable, and disable services, as well as other functionalities such as inspecting the status of services, displaying log messages, and managing system-level settings and configurations.
systemd is a Linux init system and system manager that is widely used in modern Linux distributions as the default init system. It provides a way to manage and control the various services that run on a Linux system, as well as other system-level functionality.
Here are a few examples of common tasks that can be performed using systemctl:
Start a service: systemctl start <service-name>
Stop a service: systemctl stop <service-name>
Restart a service: systemctl restart <service-name>
Enable a service to start automatically at boot: systemctl enable <service-name>
Disable a service from starting automatically at boot: systemctl disable <service-name>
Check the status of a service: systemctl status <service-name>
Overall, systemd and systemctl provide a centralized and standardized way to manage services and other system-level components on Linux, making it easier to configure and maintain a Linux system.
1.)check the status of docker service in your system (make sure you completed above tasks, else docker won’t be installed)

2. stop the service jenkins and post before and after screenshots
Before :
systemctl status jenkins

After:
systemctl stop jenkins

3. Read about the commands systemctl vs service
systemctl and service are both tools used to manage and control services on a Linux system. However, they have some differences:
systemctl is the newer tool and is used on systems that use the systemd init system, which is now widely adopted as the default init system for many popular Linux distributions, including Fedora, Red Hat Enterprise Linux, and Ubuntu.
service is the older tool and is used on systems that use the System V init system, which was the previous standard init system used in many popular Linux distributions.
systemctl provides more advanced features compared to service, such as the ability to manage units, which are the basic building blocks of Systemd. This allows you to manage not just services, but also other system components, such as sockets, devices, and mount points, with a unified interface.
service is limited to managing services only, and its syntax and options are not as advanced as those of systemctl.
service commands :
service <service-name> start
service <service-name> status
service <service-name> stop
service <service-name> restart
systemctl commands :
systemctl start <service-name>
systemctl stop <service-name>
systemctl restart <service-name>
systemctl enable <service-name>
systemctl disable <service-name>
systemctl status <service-name>
Please, feel free to drop any questions in the comments below. I would be happy to answer them.
If you find this post helpful😊🙂, please follow and click the heart❤❤ button below to show your support.
_ Thank you for reading
_sandhya kumari
]]>