<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Debug School: DanielOu</title>
    <description>The latest articles on Debug School by DanielOu (@danieloucl_709).</description>
    <link>https://www.debug.school/danieloucl_709</link>
    <image>
      <url>https://www.debug.school/images/CPDdQlGexClW9WOTxwLbEDeLKxuBxqind7bvkmstzXo/rs:fill:90:90/g:sm/mb:500000/ar:1/aHR0cHM6Ly90aGVw/cmFjdGljYWxkZXYu/czMuYW1hem9uYXdz/LmNvbS9pLzk5bXZs/c2Z1NXRmajltN2t1/MjVkLnBuZw</url>
      <title>Debug School: DanielOu</title>
      <link>https://www.debug.school/danieloucl_709</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://www.debug.school/feed/danieloucl_709"/>
    <language>en</language>
    <item>
      <title>What is Pods?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Fri, 21 Jul 2023 13:34:20 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/what-is-pods-3jib</link>
      <guid>https://www.debug.school/danieloucl_709/what-is-pods-3jib</guid>
      <description>&lt;p&gt;In Kubernetes, a Pod is the smallest deployable and manageable unit in the computing model. It represents a single instance of a running process in a cluster. A Pod encapsulates one or more closely related containers that share resources and are scheduled together on the same worker node. These containers within the Pod are always co-located and co-scheduled, and they share the same network namespace, allowing them to communicate with each other using localhost.&lt;/p&gt;

&lt;p&gt;Pods are designed to be ephemeral and can be created, deleted, or re-created frequently. They serve as a logical host for containers, providing an abstraction over the individual containers' execution environment.&lt;/p&gt;

&lt;p&gt;Here are some key points about Pods:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Atomic Unit: The containers within a Pod are treated as a single cohesive unit. They are deployed, scaled, and terminated together, maintaining strong affinity to one another.

Shared Network Namespace: All containers within a Pod share the same network namespace, meaning they can communicate over the localhost interface without any port mapping.

Shared Storage Volumes: Containers within a Pod can also share storage volumes, allowing them to exchange data or access shared files.

Use Cases: Pods are typically used to group containers that are part of the same application and need to work closely together. For instance, if a web application requires a web server and a database, you could place both containers in the same Pod to ensure they run on the same node and can communicate efficiently.

Managed by Higher-Level Controllers: While you can create individual Pods, it's more common to define Pods as part of higher-level abstractions like Deployments, StatefulSets, or ReplicaSets. These controllers manage the lifecycle of Pods, ensuring the desired number of replicas is running and handling Pod scaling and recovery from failures.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;It's important to note that Pods are considered a relatively short-lived entity in Kubernetes, and direct management of individual Pods is not recommended. Instead, Pods are usually managed as part of a higher-level workload abstraction that provides features like automatic scaling, rolling updates, and self-healing for the application.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How Kubernetes works?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Fri, 21 Jul 2023 13:31:58 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/how-kubernetes-works-pio</link>
      <guid>https://www.debug.school/danieloucl_709/how-kubernetes-works-pio</guid>
      <description>&lt;p&gt;Kubernetes works by managing and orchestrating containerized applications within a cluster of nodes. The cluster consists of one or more master nodes and multiple worker nodes. The master node(s) are responsible for controlling and coordinating the cluster, while the worker nodes are where the containers run.&lt;/p&gt;

&lt;p&gt;Here's an overview of how Kubernetes works:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Master Node Components:
    API Server: The central control point for all interactions with the cluster. It validates and processes API requests, maintaining the desired state of the system.
    etcd: A distributed key-value store that stores the configuration data and state of the cluster.
    Scheduler: Responsible for selecting suitable worker nodes for newly created pods (groups of one or more containers) based on resource requirements and constraints.
    Controller Manager: Runs various controllers that handle different aspects of the cluster, such as node control, replication, endpoints, and more.
    Cloud Controller Manager (optional): When running in cloud environments, this component integrates with the cloud provider's API to manage external resources like load balancers and storage.

Worker Node Components:
    Kubelet: The agent running on each worker node, responsible for interacting with the master node, starting and stopping pods, and reporting node status.
    Container Runtime: The software responsible for running containers, such as Docker or containerd.
    kube-proxy: Manages network communication to and from the pods. It enables service discovery and load balancing among the pods.

Pod:
    The basic scheduling unit in Kubernetes, representing one or more containers that are deployed together on the same host and share the same network namespace.
    Containers within a pod can communicate with each other using localhost, simplifying network configurations.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The typical workflow of how Kubernetes operates:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Define the Desired State: Users or administrators define the desired state of the application and its components in Kubernetes. This is done using YAML or JSON files that describe the pods, deployments, services, and other resources.

API Server Receives Requests: Users interact with the Kubernetes cluster through the API server. They can create, update, or delete resources using commands or tools like kubectl.

etcd Stores the Configuration: The API server stores the desired state in etcd, which acts as the persistent data store for the entire cluster.

Scheduler Assigns Nodes: When a new pod is created, the scheduler determines the appropriate worker node(s) on which to place it based on resource requirements, node availability, and other factors.

Kubelet Launches Containers: The kubelet on the selected worker node receives instructions from the API server and ensures the desired containers are running within the pod.

kube-proxy for Networking: The kube-proxy sets up networking rules to enable communication between pods and services.

Monitoring and Self-Healing: Kubernetes continuously monitors the state of the cluster and automatically takes action to maintain the desired state. If a pod or node fails, Kubernetes reschedules the affected containers elsewhere to maintain application availability.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;By continuously monitoring and reconciling the actual state with the desired state, Kubernetes ensures that applications run reliably, are highly available, and can scale seamlessly to meet changing demands.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Why We need Kubernetes?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Fri, 21 Jul 2023 13:27:58 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/why-we-need-kubernetes-3an4</link>
      <guid>https://www.debug.school/danieloucl_709/why-we-need-kubernetes-3an4</guid>
      <description>&lt;p&gt;Kubernetes provides several key benefits that address the challenges of managing modern containerized applications and infrastructure. Here are some reasons why we need Kubernetes:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Container Orchestration: Containers are a popular way to package and deploy applications, but managing them at scale can become complex. Kubernetes abstracts the underlying infrastructure and provides an easy way to automate container deployment, scaling, and management, making it easier to handle large numbers of containers efficiently.

Scalability: Kubernetes allows you to scale your application up or down automatically based on demand, ensuring your application can handle varying levels of traffic and workload.

High Availability: Kubernetes supports automatic failover and rescheduling of containers, making applications more reliable and resilient to node failures. If a container or node goes down, Kubernetes can automatically redeploy the container to another healthy node.

Service Discovery and Load Balancing: Kubernetes offers built-in service discovery and load balancing. It assigns a unique DNS name and IP address to each service, making it easy for other services to locate and communicate with them.

Automatic Bin Packing: Kubernetes efficiently utilizes cluster resources by packing containers onto nodes based on their resource requirements. This optimizes resource usage and ensures effective utilization of your infrastructure.

Self-Healing: Kubernetes can automatically restart containers that crash, replace containers that do not respond to health checks, and reschedule them on healthy nodes. This helps maintain application availability and uptime.

Flexibility: Kubernetes works with various container runtimes, including Docker, containerd, and others. It is also cloud-agnostic, allowing you to deploy applications on-premises, in public clouds, or in hybrid environments.

Application Updates and Rollbacks: Kubernetes supports rolling updates, allowing you to update your application without downtime. Additionally, it enables easy rollbacks to previous versions in case of issues with new releases.

Declarative Configuration: Kubernetes uses declarative YAML or JSON files to define the desired state of your application. This approach allows for version control and simplifies the process of managing and maintaining complex application configurations.

Ecosystem and Community: Kubernetes has a vast and active community, leading to a rich ecosystem of tools, services, and integrations. This makes it easier to extend and enhance the functionality of your Kubernetes cluster.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Overall, Kubernetes streamlines the deployment and management of containerized applications, reduces operational complexity, enhances scalability, and ensures high availability, making it an essential tool for modern application development and infrastructure management.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is Kubernetes?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Fri, 21 Jul 2023 13:25:21 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/what-is-kubernetes-6c8</link>
      <guid>https://www.debug.school/danieloucl_709/what-is-kubernetes-6c8</guid>
      <description>&lt;p&gt;Kubernetes is an open-source container orchestration platform designed to automate the deployment, scaling, and management of containerized applications. It was originally developed by Google and is now maintained by the Cloud Native Computing Foundation (CNCF), a part of the Linux Foundation.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Write a Ansible Playbook to install a package called “git”, “wget” and run some bash script.</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Thu, 20 Jul 2023 13:10:30 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/write-a-ansible-playbook-to-install-a-package-called-git-wget-and-run-some-bash-script-1h54</link>
      <guid>https://www.debug.school/danieloucl_709/write-a-ansible-playbook-to-install-a-package-called-git-wget-and-run-some-bash-script-1h54</guid>
      <description>&lt;p&gt;root@ip-172-31-87-83:~/daniel# cat git.yaml&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;name: Update web servers
hosts: web&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;name: Install git in ubuntu
ansible.builtin.apt:
  name: "git"
  state: latest&lt;/li&gt;
&lt;li&gt;name: Install wget in ubuntu
ansible.builtin.apt:
  name: "wget"&lt;/li&gt;
&lt;li&gt;name: Copy echo.sh
ansible.builtin.copy:
  src: echo.sh
  dest: /tmp/echo.sh&lt;/li&gt;
&lt;li&gt;name: Change file ownership, group and permissions
ansible.builtin.file:
  path: /tmp/echo.sh
  mode: '0755'&lt;/li&gt;
&lt;li&gt;name: Run a script with arguments (free form)
ansible.builtin.script: /tmp/echo.sh &lt;/li&gt;
&lt;li&gt;name: Print return information from the previous task
ansible.builtin.debug:
  msg: "The ansible task is completed successfully!"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The playbook result: &lt;br&gt;
root@ip-172-31-87-83:~/daniel# ansible-playbook -i inventory1 git.yaml -u ubuntu --key-file=node.pem -b&lt;/p&gt;

&lt;p&gt;PLAY [Update web servers] ******************************************************************************************************&lt;/p&gt;

&lt;p&gt;TASK [Gathering Facts] *********************************************************************************************************&lt;br&gt;
ok: [54.89.178.94]&lt;br&gt;
fatal: [10.22.2.2]: UNREACHABLE! =&amp;gt; {"changed": false, "msg": "Failed to connect to the host via ssh: ssh: connect to host 10.22.2.2 port 22: Connection timed out", "unreachable": true}&lt;/p&gt;

&lt;p&gt;TASK [Install git in ubuntu] ***************************************************************************************************&lt;br&gt;
ok: [54.89.178.94]&lt;/p&gt;

&lt;p&gt;TASK [Install wget in ubuntu] **************************************************************************************************&lt;br&gt;
ok: [54.89.178.94]&lt;/p&gt;

&lt;p&gt;TASK [Copy echo.sh] ************************************************************************************************************&lt;br&gt;
changed: [54.89.178.94]&lt;/p&gt;

&lt;p&gt;TASK [Change file ownership, group and permissions] ****************************************************************************&lt;br&gt;
ok: [54.89.178.94]&lt;/p&gt;

&lt;p&gt;TASK [Run a script with arguments (free form)] *********************************************************************************&lt;br&gt;
changed: [54.89.178.94]&lt;/p&gt;

&lt;p&gt;TASK [Print return information from the previous task] *************************************************************************&lt;br&gt;
ok: [54.89.178.94] =&amp;gt; {&lt;br&gt;
    "msg": "The ansible task is completed successfully!"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;PLAY RECAP *********************************************************************************************************************&lt;br&gt;
10.22.2.2                  : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0&lt;br&gt;&lt;br&gt;
54.89.178.94               : ok=7    changed=2    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0&lt;br&gt;&lt;br&gt;
&lt;a href="https://www.debug.school/images/HMxuK3sRwg6ARiwWUUOGE58gI20ifC7-0Xt1JHXsXPg/w:880/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvMDluZzVt/c2lpbGsxbnB6NWxu/cDQucG5n" class="article-body-image-wrapper"&gt;&lt;img src="https://www.debug.school/images/HMxuK3sRwg6ARiwWUUOGE58gI20ifC7-0Xt1JHXsXPg/w:880/mb:500000/ar:1/aHR0cHM6Ly93d3cu/ZGVidWcuc2Nob29s/L3VwbG9hZHMvYXJ0/aWNsZXMvMDluZzVt/c2lpbGsxbnB6NWxu/cDQucG5n" alt="Image description" width="880" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How can you mount a volume in a Docker container and share data between the host and container?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Tue, 18 Jul 2023 05:41:57 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/how-can-you-mount-a-volume-in-a-docker-container-and-share-data-between-the-host-and-container-2l85</link>
      <guid>https://www.debug.school/danieloucl_709/how-can-you-mount-a-volume-in-a-docker-container-and-share-data-between-the-host-and-container-2l85</guid>
      <description>&lt;p&gt;You can mount a directory from the host into the container using a bind mount. This method allows you to access files and directories directly from the host's filesystem.&lt;/p&gt;

&lt;p&gt;docker run -d -v /host/directory:/container/directory your_image&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How can you share a Docker image with others and pull an image from a Docker registry?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Tue, 18 Jul 2023 05:36:02 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/how-can-you-share-a-docker-image-with-others-and-pull-an-image-from-a-docker-registry-217i</link>
      <guid>https://www.debug.school/danieloucl_709/how-can-you-share-a-docker-image-with-others-and-pull-an-image-from-a-docker-registry-217i</guid>
      <description>&lt;p&gt;Push/Share the image&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Tag the image&lt;br&gt;
docker tag local_image:tag your_registry_username/repository_name:tag&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Login to Docker Hub&lt;br&gt;
docker login&lt;br&gt;
Enter your Docker Hub username and password when prompted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Push the Docker Image to the Registry&lt;br&gt;
docker push your_registry_username/repository_name:tag&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Pull image&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Login to Docker Hub&lt;br&gt;
docker login&lt;br&gt;
Enter your Docker Hub username and password when prompted.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Pull the Docker Image&lt;br&gt;
docker pull your_registry_username/repository_name:tag&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check the docker image &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;docker image ls&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How can you inspect the contents of a Docker container and the changes made to a container while it was running?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Tue, 18 Jul 2023 05:31:40 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/how-can-you-inspect-the-contents-of-a-docker-container-and-the-changes-made-to-a-container-while-it-was-running-17je</link>
      <guid>https://www.debug.school/danieloucl_709/how-can-you-inspect-the-contents-of-a-docker-container-and-the-changes-made-to-a-container-while-it-was-running-17je</guid>
      <description>&lt;p&gt;docker inspect container_id&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is a Dockerfile and how do you use it to create a Docker image</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Tue, 18 Jul 2023 05:29:34 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/what-is-a-dockerfile-and-how-do-you-use-it-to-create-a-docker-image-2deg</link>
      <guid>https://www.debug.school/danieloucl_709/what-is-a-dockerfile-and-how-do-you-use-it-to-create-a-docker-image-2deg</guid>
      <description>&lt;p&gt;A Dockerfile is a text file that contains a set of instructions for building a Docker image. It specifies the base image, copies files, installs dependencies, and sets up the environment for your application. Create a Dockerfile in the root directory of your application.&lt;/p&gt;

&lt;p&gt;Build the Docker image: Once you have a Dockerfile, you use the docker build command to build the Docker image based on the instructions in the Dockerfile. Open a terminal or command prompt, navigate to the directory containing the Dockerfile, and run the build command like this:&lt;/p&gt;

&lt;p&gt;docker build -t image_name .&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How do you create a Docker image and run a Docker container?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Tue, 18 Jul 2023 05:28:15 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/how-do-you-create-a-docker-image-and-run-a-docker-container-3hlj</link>
      <guid>https://www.debug.school/danieloucl_709/how-do-you-create-a-docker-image-and-run-a-docker-container-3hlj</guid>
      <description>&lt;p&gt;Create a Docker images from dockerfile that contains a set of instructions for building a Docker image. It specifies the base image, copies files, installs dependencies, and sets up the environment for your application. Then using the following command to build the docker image.&lt;/p&gt;

&lt;p&gt;docker build -t image_name .&lt;/p&gt;

&lt;p&gt;If you want to run the docker container, &lt;/p&gt;

&lt;p&gt;docker run -d image_name&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is a Docker image and how is it different from a Docker container?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Tue, 18 Jul 2023 05:22:12 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/what-is-a-docker-image-and-how-is-it-different-from-a-docker-container-3854</link>
      <guid>https://www.debug.school/danieloucl_709/what-is-a-docker-image-and-how-is-it-different-from-a-docker-container-3854</guid>
      <description>&lt;p&gt;A Docker image is a self-contained package that encapsulates an application and its dependencies, ensuring consistent and isolated execution across different environments using Docker containers.&lt;br&gt;
The key difference between a Docker image vs a container is  that a Docker image is a template that defines how a container will be realized. A Docker container is a runtime instance of a Docker image.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What is Docker and why is it used?</title>
      <dc:creator>DanielOu</dc:creator>
      <pubDate>Tue, 18 Jul 2023 05:11:47 +0000</pubDate>
      <link>https://www.debug.school/danieloucl_709/what-is-docker-and-why-is-it-used-5dep</link>
      <guid>https://www.debug.school/danieloucl_709/what-is-docker-and-why-is-it-used-5dep</guid>
      <description>&lt;p&gt;The docker is Contianer management tool. It could save cost, save time.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
