<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Salem on Medium]]></title>
        <description><![CDATA[Stories by Salem on Medium]]></description>
        <link>https://medium.com/@salemkim?source=rss-228c3a9b8e2a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*amO6MFPkW-iIaP9CTJfbMA@2x.jpeg</url>
            <title>Stories by Salem on Medium</title>
            <link>https://medium.com/@salemkim?source=rss-228c3a9b8e2a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 16:11:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@salemkim/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Terraform in Google Cloud: A Comprehensive Guide]]></title>
            <link>https://medium.com/@salemkim/terraform-in-google-cloud-a-comprehensive-guide-67a9a3ce490f?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/67a9a3ce490f</guid>
            <category><![CDATA[terraform]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[cloud-services]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Thu, 03 Oct 2024 16:53:59 GMT</pubDate>
            <atom:updated>2024-10-04T08:48:45.376Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*o7gzN_j4accYOxLGKdwRNQ.png" /><figcaption>AI generated image of Cloud Infrastructure as Code IaC</figcaption></figure><h3>Objectives</h3><ol><li>Install Terraform from installation binaries.</li><li>Create a VM instance infrastructure using Terraform.</li></ol><h3>Prerequisites</h3><p>Before diving into Terraform, ensure you have the Google Cloud SDK installed and configured. You can list your active account and authorize it using:</p><pre>gcloud auth list</pre><p>To list your project ID, use:</p><pre>gcloud config list project</pre><h3>What is Terraform?</h3><p>Terraform is an open-source infrastructure as code (IaC) software tool created by HashiCorp. It allows you to define and provision data center infrastructure using a high-level configuration language.</p><h3>Uses of Terraform</h3><ol><li><strong>Building, changing, and versioning infrastructure safely and efficiently.</strong></li><li><strong>Managing existing and popular service providers as well as custom in-house solutions.</strong></li></ol><h3>Configuration Files</h3><p>Terraform configuration files are written in HashiCorp Configuration Language (HCL) or JSON. These files describe the components needed to run a single application or an entire data center. When configurations change, Terraform determines what changed and creates an incremental execution plan that can be applied.</p><h3>Infrastructure Components Managed by Terraform</h3><ol><li>Compute instances</li><li>Storage</li><li>Networking</li><li>DNS entries</li><li>SaaS features like monitoring, logging, databases, etc.</li></ol><h3>Features of Terraform</h3><ol><li><strong>Infrastructure as Code</strong>: High-level configuration syntax allows the blueprint of a data center to be versioned and treated as any other code. Infrastructure can be shared and reused.</li><li><strong>Execution Plans</strong>: Terraform has a “planning” step where it generates an execution plan. The apply command can then execute the plan to reach the desired state of the configuration, ensuring no surprises.</li><li><strong>Resource Graph</strong>: Terraform builds a graph of all resources and parallelizes the creation and modification of any non-dependent resources, providing insights into dependencies in the infrastructure.</li><li><strong>Change Automation</strong>: Complex changesets can be applied to infrastructure with minimal human interaction.</li></ol><h3>Installation of Terraform</h3><p>To verify whether Terraform is installed, run:</p><pre>terraform --version</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGj6NJGEtzjAmjoyoJKCRg.png" /><figcaption>image of checking the installed terraform version</figcaption></figure><p>Altenatively you can check out to install and configure terraform for Google Cloud on the official documentation here <a href="https://cloud.google.com/docs/terraform/install-configure-terraform">https://cloud.google.com/docs/terraform/install-configure-terraform</a></p><h3>Terraform Configuration</h3><p>Configuration files are used to describe the infrastructure. Here is an example configuration file (instance.tf) to create a VM instance:</p><pre>resource &quot;google_compute_instance&quot; &quot;terraform&quot; {<br>  project      = &quot;qwiklabs-gcp-01-5843afb5222e&quot;<br>  name         = &quot;terraform&quot;<br>  machine_type = &quot;e2-medium&quot;<br>  zone         = &quot;europe-west1-b&quot;<br><br>boot_disk {<br>    initialize_params {<br>      image = &quot;debian-cloud/debian-11&quot;<br>    }<br>  }<br>  <br>network_interface {<br>    network = &quot;default&quot;<br>    access_config {<br>    }<br>  }<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EtvYMlVsM9PiNSakDkrX3A.png" /><figcaption>image of instance.tf configuration file</figcaption></figure><ul><li>The resource block defines resources that exist within the infrastructure, such as compute instances, disks, networks, etc.</li><li>google_compute_instance is a resource type.</li><li>terraform is a resource name.</li></ul><h3>Initializing Terraform and Installing Provider Binary</h3><p>Run the following command in the same directory as the configuration files:</p><pre>terraform init</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xz87Lj2gcF1mImcUBbKJ6Q.png" /><figcaption>image of initializing terraform</figcaption></figure><p>This should be done for a new configuration or an existing configuration for version control.</p><h3>Creating an Execution Plan</h3><p>A refresh is performed, and Terraform determines the actions necessary to achieve the desired state specified in the configuration files. You can run this multiple times to see the changes that will be made before committing a change to version control:</p><pre>terraform plan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tigol64NpYyaeEsZqUCJ_w.png" /><figcaption>image of output of terraform plan command</figcaption></figure><p>To save the execution plan to a file:</p><pre>terraform plan -out=plan</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vQUXrCeNG3gp9fny34ZXnw.png" /><figcaption>image of output of terraform plan command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WJSY8WgCTtoygj4cBGVygQ.png" /><figcaption>image of plan output file</figcaption></figure><h3>Applying Changes</h3><p>To apply the changes:</p><pre>terraform apply</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gLGq0s0JtOLW_FwBmGzreg.png" /><figcaption>image of terraform apply command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9_abxZvihRCu6BkQ9_0SGQ.png" /><figcaption>image of terraform apply command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0jVKo4osx770U8B8WxH10g.png" /><figcaption>image of successful deployment of infrastructure using terraform apply command</figcaption></figure><ul><li>+ means that Terraform will create the resource.</li><li>&lt;computed&gt; means that Terraform will determine the value once the resource is created.</li></ul><p>Type yes to apply the changes.</p><h3>Confirming the Instance Creation</h3><p>A terraform.tfstate file is created. It keeps track of the IDs of created resources so that Terraform knows what it is managing. To inspect the current state:</p><pre>terraform show</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-7Xr_QYoo4QF8Cq23VJf0g.png" /><figcaption>image of confirming deployment of a compute instance on Google Cloud</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ERL-4udn-9M14xTrb8a-4g.png" /><figcaption>image of confirming deployment of a compute instance using gcloud command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ph-BS8d1B2G4__lqrcShYQ.png" /><figcaption>image of confirming deployment of compute instance using Google Cloud Console</figcaption></figure><h3>Custom Provider Plugins</h3><p>You can create custom provider plugins with Terraform to extend its functionality.</p><p>By following these steps, you can efficiently manage your Google Cloud infrastructure using Terraform. Happy coding! 🚀</p><h3>About the Author</h3><p>Salem Kim is a passionate cloud computing enthusiast with a keen interest in Linux systems and programming. When not exploring the latest in tech, he enjoys sharing knowledge and helping others navigate the digital landscape.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67a9a3ce490f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding AI and ML: A Comprehensive Guide ]]></title>
            <link>https://medium.com/@salemkim/understanding-ai-and-ml-a-comprehensive-guide-40cb51bd8ef0?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/40cb51bd8ef0</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Tue, 03 Sep 2024 12:32:37 GMT</pubDate>
            <atom:updated>2024-09-03T12:32:37.410Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3IgsG0R4BxeMGVKaTe18Q.jpeg" /></figure><h3>The Difference Between AI and ML</h3><p>Artificial Intelligence (AI) is a broad field of computer science focused on creating systems capable of performing tasks that typically require human intelligence. This includes areas like machine learning, deep learning, and natural language processing. AI aims to build machines that can think, learn, and adapt. 🌟</p><p>Machine Learning (ML), on the other hand, is a subset of AI. It involves developing algorithms that allow computers to learn from and make predictions based on data. ML encompasses various techniques, including supervised learning, unsupervised learning, and reinforcement learning. 📈</p><p>Generative AI is a fascinating branch of deep learning that focuses on generating new data. This can include creating new images, music, or text. Generative AI models learn patterns from existing data and use this knowledge to produce novel outputs. 🎨🎶</p><h3>Supervised vs. Unsupervised Learning</h3><p>Supervised Learning involves training a model on labeled data. This means that each training example is paired with an output label. The model learns to make predictions or classify data into categories based on this labeled data. Supervised learning is commonly used for tasks like classification and regression. 🏷️</p><p>Unsupervised Learning uses unlabeled data to train models. The goal here is to identify patterns and trends within the data without any predefined labels. Unsupervised learning is often used for clustering data into groups or reducing the dimensionality of data. 🔍</p><h3>Types of Supervised Learning</h3><ol><li>Classification: This type of supervised learning predicts categorical variables. For example, logistic regression can be used to classify emails as spam or not spam. 📧</li></ol><p>2. Regression: This type of supervised learning predicts numerical variables. Linear regression, for instance, can be used to predict house prices based on various features. 🏡</p><h3>Types of Unsupervised Learning</h3><ol><li>Clustering: This technique groups similar data points together. K-means clustering is a popular method used to segment customers based on purchasing behavior. 🛍️</li></ol><p>2. Association: This method identifies patterns and relationships within data. Association rule learning can be used to find products that are frequently bought together. 🛒</p><p>3. Dimensionality Reduction: This technique reduces the number of dimensions in data, making it easier to visualize and analyze. Principal Component Analysis (PCA) is a common method used for this purpose. 📉</p><h3>Sample Problem Set: Supervised and Unsupervised Learning</h3><h4>1. Predicting Customer Spending Based on Purchase History</h4><p>Problem Statement: You are given a table with customer ID, purchase history, and total spending.</p><ul><li><strong>Type of Learning</strong>: This is a supervised learning problem because the target variable is total spending, which is a numerical variable. The model is trained to predict the total spending based on purchase history. There is also labeled data available for training the model.</li><li><strong>Classification or Regression</strong>: This is a regression problem since it predicts a continuous numerical variable, total spending.</li><li><strong>ML Model to Use</strong>: Linear regression should be used to predict customer spending based on purchase history, as it is suitable for regression problems. Logistic regression is used for classification problems.</li></ul><h4>2. Identifying Customer Segmentation Using the Same Dataset</h4><p>Problem Statement: You want to identify customer segments without basing judgments on gender or age.</p><ul><li><strong>Type of Learning</strong>: This is an unsupervised learning problem because there is no target variable to predict. The goal is to identify patterns and groups in the data without using labels.</li><li><strong>Clustering, Association, or Dimensionality Reduction</strong>: This is a clustering problem.</li><li><strong>ML Model to Use</strong>: K-means clustering analysis should be used because it is designed to group similar data points together without using labels.</li></ul><h3>Conclusion</h3><p>Understanding the differences between AI, ML, and their various techniques is crucial for anyone diving into the world of data science and technology. Whether you’re interested in creating intelligent systems or analyzing complex data, these concepts form the foundation of modern computational intelligence. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40cb51bd8ef0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Provisioning a Complete Kubernetes Cluster Using Google Kubernetes Engine (GKE) ]]></title>
            <link>https://medium.com/@salemkim/provisioning-a-complete-kubernetes-cluster-using-google-kubernetes-engine-gke-a20a6fcc3f46?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a20a6fcc3f46</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[developer]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Mon, 26 Aug 2024 18:13:53 GMT</pubDate>
            <atom:updated>2024-08-26T18:13:53.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADU18gp92dvCNwUCvkS4Yw.jpeg" /></figure><p>Setting up a Kubernetes cluster can seem daunting, but with Google Kubernetes Engine (GKE), it’s a breeze! Here’s a step-by-step guide to get you started. 🌟</p><h4>1. Activate Your Account and Authorize 🔑</h4><p>First, you need to activate your account and authorize it:</p><pre>gcloud auth list</pre><h4>2. List Your Project ID 🆔</h4><p>Next, list your project ID:</p><pre>gcloud config list project</pre><h4>3. Set Your Zone 🌍</h4><p>Set the compute zone where your cluster will be located:</p><pre>gcloud config set compute/zone [ZONE]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QQ8ZenY70q8U5fN_Cm9mBA.png" /></figure><h4>4. Start a Kubernetes Cluster Managed by GKE 🌐</h4><p>Create your Kubernetes cluster:</p><pre>gcloud container clusters create [CLUSTER_NAME] --zone [ZONE]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uMvjmNYoW81rrZBrOJZ8Ng.png" /></figure><p>Replace [CLUSTER_NAME] with your desired cluster name and [ZONE] with your chosen zone.</p><h4>5. Re-authenticate to Your Cluster 🔄</h4><p>In case you lose connection, re-authenticate back to your cluster:</p><pre>gcloud container clusters get-credentials [CLUSTER_NAME]</pre><h4>6. Get Sample Code 📂</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYNPC9tN1RO5-pp_ghwdfA.png" /></figure><p>Copy sample code from a bucket to your current working directory:</p><pre>gsutil cp -r gs://spls/gsp021/* .</pre><p>The -r flag copies the files recursively.</p><h4>7. Change to the Directory with the Sample Code 📁</h4><p>Navigate to the directory containing the sample code:</p><pre>cd orchestrate-with-kubernetes/kubernetes</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*B-t43UA-Bz4MwaZf9ku7fg.png" /></figure><h3>Deploy and Manage Docker Containers Using kubectl 🐳</h3><h4>8. Launch a Single Instance of the Nginx Container 🌐</h4><p>Create a deployment for the Nginx container:</p><pre>kubectl create deployment nginx --image=nginx:1.10.0</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1S6agIWDMeG2_CYINydTEg.png" /></figure><p>Deployments ensure that pods remain up and running even if the nodes they run on fail.</p><h4>9. View the Running Nginx Container 👀</h4><p>Check the status of your Nginx container:</p><pre>kubectl get pods</pre><h4>10. Expose the Container to the Public Internet 🌐</h4><p>Expose your Nginx deployment:</p><pre>kubectl expose deployment nginx --port 80 --type LoadBalancer</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bTehzA451Mz5ohfr42SN_g.png" /></figure><p>Kubernetes will create an external LoadBalancer with a public IP attached to it, forwarding traffic to the Nginx pod.</p><h4>11. View the New Service 🔍</h4><p>Check the services to see your new LoadBalancer:</p><pre>kubectl get services</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CS4KlpfCxBt1dUkY1DKHFQ.png" /><figcaption>image of viewing services and confirming that the LoadBalancer service is created</figcaption></figure><h4>12. Confirm the Nginx Server is Running ✅</h4><p>Use curl to confirm that the Nginx server is running:</p><pre>curl http://[EXTERNAL-IP]:80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WlVNvU467380yEBH4Qd_9Q.png" /><figcaption>image showing nginx is running on port 80</figcaption></figure><h3>Understanding Pods 🧩</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*fZuPty30MF2cjB--6k2iMA.png" /><figcaption>image of a pod</figcaption></figure><p>Pods represent a collection of one or more containers. They share namespaces and have a single IP address. Here are some key points:</p><p><strong>Logical Applications of Pods</strong>:</p><ul><li>Consist of one or more containers and volumes.</li><li>Shared namespaces.</li><li>Each pod has one IP.</li></ul><p><strong>Examples of Containers</strong>:</p><ul><li>Monolith container.</li><li>Nginx container.</li></ul><h3>Volumes 📦</h3><p>Volumes are data disks that live as long as pods live and can be used by containers in the pod. They provide a shared namespace for their contents.</p><p><strong>Examples of Volumes</strong>:</p><ol><li>GCE Persistent Disks.</li><li>iSCSI.</li><li>NFS.</li></ol><h3>Creating Pods 🛠️</h3><p>Inside the Kubernetes directory, you can create a pod using a YAML configuration file. Here’s an example configuration for a monolith pod:</p><pre>apiVersion: v1<br>kind: Pod<br>metadata:<br>  name: monolith<br>  labels:<br>    app: monolith<br>spec:<br>  containers:<br>    - name: monolith<br>      image: kelseyhightower/monolith:1.0.0<br>      args:<br>        - &quot;-http=0.0.0.0:80&quot;<br>        - &quot;-health=0.0.0.0:81&quot;<br>        - &quot;-secret=secret&quot;<br>      ports:<br>        - name: http<br>          containerPort: 80<br>        - name: health<br>          containerPort: 81<br>      resources:<br>        limits:<br>          cpu: 0.2<br>          memory: &quot;10Mi&quot;</pre><p>Create the monolith pod:</p><pre>kubectl create -f [PATH_TO_YAML_FILE]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y9f2FlSsWUZKSsPQUFItzA.png" /></figure><p>Replace [PATH_TO_YAML_FILE] with the path to your YAML file.</p><p>List the pods:</p><pre>kubectl get pods</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*63DH34zZMAz78VAKVxqq8g.png" /><figcaption>image of listing pods and information about the monolith pod</figcaption></figure><p>Get more information about the monolith pod:</p><pre>kubectl describe pods monolith</pre><h3>And there you have it! 🎉 You’ve successfully provisioned a complete Kubernetes cluster using Google Kubernetes Engine and deployed a containerized application. Happy coding! 🚀</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a20a6fcc3f46" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy Applications with Kubernetes: Breaking the Monolith app into Microservices ]]></title>
            <link>https://medium.com/@salemkim/deploy-applications-with-kubernetes-breaking-the-monolith-app-into-microservices-251938adfec0?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/251938adfec0</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Mon, 26 Aug 2024 17:43:43 GMT</pubDate>
            <atom:updated>2024-08-26T17:43:43.816Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWhVOlWrHAefpekkKddLBQ.jpeg" /></figure><p>In today’s fast-paced tech world, deploying applications efficiently is crucial. Kubernetes, a powerful container orchestration tool, allows us to break down monolithic applications into microservices, making deployment, scaling, and management a breeze. Let’s dive into how you can deploy applications using Kubernetes deployments and services. 🌐</p><h4>What are Deployments? 🤔</h4><p>Deployments in Kubernetes are a declarative way to ensure that the number of pods running matches the desired number specified by the user. They abstract the low-level details of managing pods, using replica sets to manage and stop pods. Deployments handle pod updates, scaling, and restarting, ensuring that your application is always running smoothly.</p><h4>Creating Deployments 🛠️</h4><p>We’ll break down a monolithic application into three microservices using deployment configuration files:</p><ol><li><strong>Auth Service</strong>: Generates JWT tokens for authenticated users.</li><li><strong>Hello Service</strong>: Greets authenticated users.</li><li><strong>Frontend Service</strong>: Routes traffic to the auth and hello services.</li></ol><p>Each service will have its own deployment and service configuration.</p><h4>Example: Auth Deployment</h4><p>Here’s an example of a deployment configuration file for the auth service:</p><pre>apiVersion: apps/v1<br>kind: Deployment<br>metadata:<br>  name: auth<br>spec:<br>  selector:<br>    matchLabels:<br>      app: auth<br>  replicas: 1<br>  template:<br>    metadata:<br>      labels:<br>        app: auth<br>        track: stable<br>    spec:<br>      containers:<br>        - name: auth<br>          image: &quot;kelseyhightower/auth:2.0.0&quot;<br>          ports:<br>            - name: http<br>              containerPort: 80<br>            - name: health<br>              containerPort: 81</pre><p>This configuration describes a deployment with a single replica running the auth image. The container listens on port 80 for HTTP traffic and port 81 for health checks.</p><h4>Scaling Deployments 📈</h4><p>To scale the number of pods, simply change the number specified in the replicas field in the deployment manifest.</p><h4>Creating Services 🌐</h4><p>After creating the deployments, we need to create services to expose these deployments:</p><pre># Create auth deployment<br>kubectl create -f deployments/auth.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LtB2I-ULDlSZH5bT3fPUtw.png" /></figure><pre># Create service for the auth deployment<br>kubectl create -f services/auth.yaml</pre><pre># Create hello deployment<br>kubectl create -f deployments/hello.yaml</pre><pre># Create service for the hello deployment<br>kubectl create -f services/hello.yaml</pre><pre># Confirm that the deployments are created<br>kubectl get deployments</pre><pre># Confirm that the services are created<br>kubectl get services</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o21EyWFbwcWLEms7xJ03Xw.png" /></figure><h4>ConfigMaps for Configuration 📋</h4><p>Create a ConfigMap to store configuration data for the frontend service:</p><pre>kubectl create configmap nginx-frontend-conf --from-file=nginx/frontend.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oniVRLWRHz2NrxhZk4DqIw.png" /></figure><h4>Frontend Deployment and Service 🌐</h4><p>Finally, create the frontend deployment and service:</p><pre># Create frontend deployment<br>kubectl create -f deployments/frontend.yaml</pre><pre># Create service for the frontend deployment<br>kubectl create -f services/frontend.yaml</pre><pre># Get frontend service external IP<br>kubectl get services frontend</pre><p>ok, now talk to the frontend service. You can get the external IP by listing the frontend services</p><pre># Talk to the frontend service<br>curl -k https://&lt;EXTERNAL_IP&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GGMb0LTTQ2WieYfhwEjoEg.png" /></figure><h4>Conclusion 🎉</h4><p>By breaking down your monolithic application into microservices and deploying them with Kubernetes, you can achieve greater scalability, reliability, and ease of management. Kubernetes deployments and services make it simple to manage the lifecycle of your applications, ensuring they are always running as expected. Happy deploying! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=251938adfec0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rolling Out Upgrades to Your Service with Kubernetes ]]></title>
            <link>https://medium.com/@salemkim/rolling-out-upgrades-to-your-service-with-kubernetes-322d40a49d90?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/322d40a49d90</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Sun, 25 Aug 2024 14:25:45 GMT</pubDate>
            <atom:updated>2024-08-25T14:25:45.363Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NX3Emqb0RwCRiqdNXWzxDw.jpeg" /></figure><p>In the dynamic world of software development, applications deployed to production often require bug fixes or additional features. Kubernetes makes it seamless to deploy new versions without impacting users. Let’s dive into the process of rolling out upgrades to your service using Kubernetes, with a step-by-step guide and some handy tips! 🌟</p><h4>Step 1: Modify Your Application Code 🛠️</h4><p>First, let’s update the response message in your server.js application.</p><pre># Open server.js in vim<br>vim server.js</pre><pre># Update the response message<br>response.end(&quot;Hello Kubernetes World!&quot;);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*y0QK4J1rqa93EOG1rR6shw.png" /></figure><h4>Step 2: Build a New Container Image 🏗️</h4><p>Next, build a new container image with the updated code and a new tag using the same Dockerfile in the current folder.</p><pre># Build the new container image<br>docker build -t gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v2 .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YgSOauU9spKRGEzirYUnNw.png" /></figure><h4>Step 3: Push the New Image to Container Registry 📤</h4><p>Push the newly built image to the Container Registry.</p><pre># Push the new image<br>docker push gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v2</pre><p><strong>Tip:</strong> Docker will use the cache to speed up the build process. If you want to rebuild the image without using the cache, use the --no-cache flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iKmFs80pWlvYhy9pIf24lA.png" /></figure><h4>Step 4: Update the Deployment with the New Image 🔄</h4><p>To change the image label for your running container, edit the existing deployment.</p><pre># Edit the deployment<br>kubectl edit deployment [DEPLOYMENT_NAME]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*iKmFs80pWlvYhy9pIf24lA.png" /></figure><p>A YAML file will open in vim. Change the image label to the new image label and save the file.</p><pre>spec:<br>  containers:<br>    - name: hello-node<br>      image: gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jkzqx8fb_fzzY1tQ-1xcQA.png" /></figure><h4>Step 5: Apply the Changes and Monitor the Deployment 📈</h4><p>Update the deployment with the new image. Kubernetes will create new pods with the updated image and delete the old pods. Users will start accessing the new version of the application seamlessly.</p><pre># Get deployments to verify the update<br>kubectl get deployments</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d1NT5SJ1q1brual23hBa2g.png" /></figure><h3>Features of Kubernetes 🌐</h3><p>Kubernetes offers several powerful features that make it an excellent choice for managing your applications:</p><ol><li><strong>Integrated Logging and Monitoring</strong> 📊: Kubernetes provides built-in tools for logging and monitoring, helping you keep track of your application’s performance and health.</li><li><strong>Stateful Application Support</strong> 💾: Kubernetes supports stateful applications, ensuring data persistence and consistency.</li><li><strong>IAM (Identity and Access Management)</strong> 🔐: Kubernetes integrates with IAM systems to manage user permissions and access control effectively.</li></ol><p>Kubernetes allows you to focus on developing your application rather than worrying about the underlying infrastructure. With its robust features and seamless upgrade process, you can ensure your application is always up-to-date and running smoothly. 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=322d40a49d90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating and Managing Pods in Kubernetes ]]></title>
            <link>https://medium.com/@salemkim/creating-and-managing-pods-in-kubernetes-a1e0b800aaf5?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1e0b800aaf5</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Sun, 25 Aug 2024 13:50:54 GMT</pubDate>
            <atom:updated>2024-08-25T13:50:54.539Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rVtyvm4mv1XlVyTyY21DFQ.jpeg" /></figure><p>Kubernetes is a powerful tool for managing containerized applications. One of its core concepts is the <strong>Pod</strong>, which is a group of containers that are managed together. Let’s dive into how to create and manage Pods using Kubernetes, with some handy commands and tips! 🛠️</p><h4>What is a Pod? 🤔</h4><p>A Pod is the smallest deployable unit in Kubernetes. It can contain one or multiple containers that share the same network namespace and storage. Pods are designed to run a single instance of a given application.</p><h3>Creating a Pod by Creating a Deployment Object</h3><p>To create a Pod, you typically create a Deployment object. This ensures that your application is always running the desired number of Pods.</p><pre># Create a deployment<br>kubectl create deployment hello-node --image=gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v1</pre><p>In this command:</p><ul><li>hello-node is the name of the deployment.</li><li>gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v1 is the image used for the container.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r7W-4Rmfq1Nc37huBRjxlQ.png" /><figcaption>image of creating deployment hello-node</figcaption></figure><h3>Viewing Deployments and Pods 📋</h3><p>Once you’ve created your deployment, you can view it and the Pods it creates:</p><pre># View deployments<br>kubectl get deployments</pre><pre># View Pods created by the deployment<br>kubectl get pods</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KnSHDr4KWnvTc9g2lAuxRw.png" /><figcaption>image of viewin deployments, pods and cluster information</figcaption></figure><h3>Viewing Cluster Information and Configuration 🖥️</h3><p>To get more information about your cluster and its configuration, use the following commands:</p><pre># View cluster information<br>kubectl cluster-info</pre><pre># View kubectl configuration<br>kubectl config view</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Za2zKDTEZUaCP2MRnpXFQ.png" /><figcaption>image of viewing kubectl configuration</figcaption></figure><h3>Troubleshooting with kubectl 🛠️</h3><p>Kubernetes provides several commands to help you troubleshoot your cluster:</p><pre># View cluster events<br>kubectl get events</pre><pre># View Pod logs<br>kubectl logs &lt;pod-name&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uC_Ar0LrRiFYOOEA8Tb_6Q.png" /><figcaption>image of viewing cluster configuration</figcaption></figure><h3>Allowing External Traffic to the Pod 🌐</h3><p>By default, Pods are only accessible within the cluster. To make a Pod accessible from outside the Kubernetes virtual network, you need to expose it as a Kubernetes Service.</p><pre># Expose the deployment to the public internet<br>kubectl expose deployment hello-node --type=&quot;LoadBalancer&quot; --port=8080</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dlJcA_8zJuhGRzObKjZ3Kw.png" /><figcaption>image of exposing deployment to the public internet</figcaption></figure><p>This command creates a Load Balancer service that makes your deployment accessible from the internet. Kubernetes will handle creating the necessary load balancer, forwarding rules, target pools, and firewall rules.</p><p>To find the publicly accessible IP, list all cluster services:</p><pre># List all services<br>kubectl get services</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8BGvDee1s_7Yq6UWVZ2SYA.png" /><figcaption>image of viewing external IP of the exposed hello-node deployment</figcaption></figure><p>You’ll see two IP addresses for your hello-node service:</p><ul><li><strong>CLUSTER-IP</strong>: Internal IP visible only inside your cloud virtual network.</li><li><strong>EXTERNAL-IP</strong>: External load-balanced IP.</li></ul><p>Access your service using the EXTERNAL-IP:</p><pre>http://&lt;EXTERNAL_IP&gt;:8080</pre><h3>Scaling Up Your Service 📈</h3><p>To handle more traffic, you can scale up your service by increasing the number of replicas for your Pod:</p><pre># Set the number of replicas<br>kubectl scale deployment hello-node --replicas=4</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_xmkDVbpRsgX1wU-YFBcrw.png" /><figcaption>image of setting up number of replicas</figcaption></figure><p>Confirm the number of replicas:</p><pre># Check the deployment<br>kubectl get deployment</pre><pre># List all Pods<br>kubectl get pods</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ouLw2KfGxIy4jT72QkYtFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sz8Zgue0OcwwsqZ0pnqRww.png" /><figcaption>images of checking deployment and pods</figcaption></figure><h3>Declarative Approach 📜</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/897/1*B1si2sygxeUdJ_bw8IeM5A.png" /></figure><p>Kubernetes uses a declarative approach to manage the desired state of your cluster. This means you declare the number of instances you want running, and Kubernetes ensures that reality matches your request.</p><p>By following these steps, you can effectively create, manage, and scale Pods in Kubernetes. Happy containerizing! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1e0b800aaf5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Your Node.js App on Kubernetes Engine ]]></title>
            <link>https://medium.com/@salemkim/deploying-your-node-js-app-on-kubernetes-engine-a1aca6a0e33a?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1aca6a0e33a</guid>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Sun, 25 Aug 2024 13:31:47 GMT</pubDate>
            <atom:updated>2024-08-25T13:31:47.615Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kx8frF4SUTcQlmfAY8GEDA.jpeg" /></figure><p>In this article, we’ll walk through the steps to turn your Node.js code into a replicated application running on Kubernetes, using Google Kubernetes Engine (GKE). Let’s get started! 🌟</p><h4>What is Kubernetes? 🤔</h4><p>Kubernetes is an open-source platform for managing containerized applications. It automates deployment, scaling, and operations of application containers across clusters of hosts.</p><h4>What is Kubernetes Engine? 🛠️</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*Tkc-8HiJ3aSaK4kSa-9GrA.png" /></figure><p>Kubernetes Engine is a managed environment for deploying, managing, and scaling your containerized applications using Google infrastructure.</p><h4>Platforms That Can Run Kubernetes 🖥️</h4><ol><li>Laptops</li><li>Multi-node clusters</li><li>Public clouds</li><li>On-premise deployments</li><li>VMs</li><li>Bare metal</li></ol><h3>Step-by-Step Guide 📝</h3><h4>1. Activate Account and Authorize 🔐</h4><pre>gcloud auth list</pre><h4>2. List Project ID 🆔</h4><pre>gcloud config list project</pre><h4>3. Create a Node.js App 💻</h4><p>Create a simple Node.js server:</p><pre>// server.js<br>var http = require(&#39;http&#39;);<br>var handleRequest = function(request, response) {<br>  response.writeHead(200);<br>  response.end(&quot;Hello World!&quot;);<br>}<br>var www = http.createServer(handleRequest);<br>www.listen(8080);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pcFEfu11JA0Hhf4LFjNRFw.png" /><figcaption>image of creating a simple Hello World nodejs app using vim editor</figcaption></figure><p>Start the server:</p><pre>node server.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nE46WKlsx_vRLNBP6bWVgQ.png" /><figcaption>image of starting the nodejs server and previewing it on port 8080</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xRJ_QOSuv1VVMHWLVLvfRQ.png" /><figcaption>image showing Hello World from the created nodejs app</figcaption></figure><p>Test the server in another terminal:</p><pre>curl http://localhost:8080</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*sCUdX0ZqJApui5rOnu4RNQ.png" /><figcaption>image of testing server using the curl command</figcaption></figure><p>Stop the server with ctrl+c.</p><h4>4. Create a Docker Container Image 🐳</h4><p>Create a Dockerfile:</p><p>Dockerfile</p><pre>cat &gt; Dockerfile &lt;&lt;EOF<br>FROM node:6.9.2<br>EXPOSE 8080<br>COPY server.js .<br>CMD node server.js<br>EOF</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jzBAezchI8RZlxd05x9hxw.png" /><figcaption>image of creating a Dockerfile using vim editor</figcaption></figure><p>Build the Docker image using the docker file in the current directory:</p><pre>docker build -t gcr.io/&quot;PROJECT_ID&quot;/hello-node:v1 .</pre><p>Replace &quot;PROJECT_ID&quot; with your project ID:</p><pre>echo $DEVSHELL_PROJECT_ID<br>docker build -t gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v1 .</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MhvbCghV7fQSueI6JiIqtA.png" /><figcaption>image of building docker image</figcaption></figure><p>Confirm the image has been built:</p><pre>docker images</pre><p>Test the image locally:</p><pre>docker run -d -p 8080:8080 gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v1<br>curl http://localhost:8080</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yeYWAMGIvIziFmuf7qFPLQ.png" /><figcaption>image of running the hello-node docker image</figcaption></figure><p>Stop the running container:</p><p>Use the<em> docker ps</em> command to get the container ID of the running container then use it to stop it from running</p><pre>docker ps<br>docker stop [container ID]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9k0D3uKEZXPmq7XMR6faUQ.png" /><figcaption>image of stopping the running docker image</figcaption></figure><h4>5. Push Image to Google Container Registry 📦</h4><p>Configure Docker to authenticate to Container Registry:</p><pre>gcloud auth configure-docker</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GgWpSS11hcKJL-WDDtGYNA.png" /><figcaption>image of configuring docker with google container registry</figcaption></figure><p>Push the image:</p><pre>docker push gcr.io/$DEVSHELL_PROJECT_ID/hello-node:v1</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IrqSuxWP8N-81ngJcP2N3Q.png" /><figcaption>image showing the docker image been pushed successfully to the google container registry</figcaption></figure><p>Confirm the image is in Container Registry via the navigation menu: <strong>CI/CD &gt; Container Registry</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gW39pp2chWSjuvW1FXuS2w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*STZIBh5HOREFjvYItbvo9w.png" /><figcaption>images showing docker image has been pushed to google cloud</figcaption></figure><h4>6. Create a Kubernetes Engine Cluster 🌐</h4><p>Set the project ID:</p><pre>gcloud config set project [PROJECT_ID]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*o7nPZ7l5ZWIA3Pk3Pl2Irg.png" /><figcaption>image of setting project ID on gcloud CLI</figcaption></figure><p>Create the cluster:</p><pre>gcloud container clusters create [CLUSTER-NAME] \<br>--num-nodes 2 \<br>--machine-type e2-medium \<br>--zone &quot;[ZONE]&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FkwhuEqHIz8ZisJ9DF14uw.png" /><figcaption>image of creating a Kubernetes cluster</figcaption></figure><p>Replace [PROJECT_ID], [CLUSTER-NAME], and [ZONE] with your details. Confirm the clusters have been created using the Google Cloud Console or CLI:</p><pre>gcloud container clusters list</pre><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*nhi5XQyVR5SsHQHCXUW9Fw.png" /><figcaption>image of listing the created hello-world cluster</figcaption></figure><p>clusters should be created in the same zone as the storage bucket used by the container registry</p><p>to confirm that the clusters have been created</p><p>using google cloud console</p><p><strong>navigation menu &gt; Kubernetes Engine &gt; Clusters</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MWivrJxdgXvRH9qZyUvZGA.png" /><figcaption>image showing hello-world cluster in Kubernetes engine on google cloud</figcaption></figure><h3>Conclusion 🎉</h3><p>You’ve successfully turned your Node.js code into a replicated application running on Kubernetes Engine! This powerful setup allows you to automate deployment, scaling, and operations of your applications with ease. Happy coding! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1aca6a0e33a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging Docker Containers and Publishing Images to Google Artifact Registry ]]></title>
            <link>https://medium.com/@salemkim/debugging-docker-containers-and-publishing-images-to-google-artifact-registry-42ee2f8c9e77?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/42ee2f8c9e77</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Sat, 24 Aug 2024 17:28:10 GMT</pubDate>
            <atom:updated>2024-08-24T17:28:10.397Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A-3TRm29mzP4EBuJHZLXvQ.jpeg" /><figcaption>AI generated image of google cloud and docker</figcaption></figure><p>Debugging Docker containers can be a bit tricky, but with the right commands, you can easily get the information you need. Let’s dive into some essential commands and steps to debug your containers and publish images to Google Artifact Registry.</p><h3>Viewing Logs of a Container 📜</h3><p>To view the logs of a container, use the following command:</p><pre>docker logs [container-name]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9BF62TkvugQw2Cj7amSe1A.png" /><figcaption>image of viewing logs of my-app-2 container</figcaption></figure><p>If you want to view the logs in real-time, you can use the -f flag:</p><pre>docker logs -f [container-name]</pre><p>The -f flag is used to follow the logs as they are being written.</p><h3>Starting an Interactive Bash Session 🖥️</h3><p>To start an interactive bash session in a running container, use:</p><pre>docker exec -it [container-name] bash</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E9ItZLIzj5BJoceYiE3iyA.png" /></figure><p>The -it flag is used to start an interactive session by allocating a pseudo-TTY and keeping STDIN open. The bash session will run in the WORKDIR directory /app specified in the Dockerfile.</p><h3>Listing Files in the Container 📂</h3><p>Once inside the container, you can list the files using:</p><pre>ls</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FNWVgBNJ37NF2wv4i4nQPA.png" /><figcaption>image showing various container operations</figcaption></figure><h3>Exiting the Bash Session 🚪</h3><p>To exit the bash session, simply type:</p><pre>exit</pre><h3>Examining Container Metadata 🔍</h3><p>To examine the metadata of a container, use:</p><pre>docker inspect [container-name]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xQwhWtQLIFcJmbBiQpWnLA.png" /></figure><p>If you want to inspect specific fields from the returned JSON and get the IP address of the container, use:</p><pre>docker inspect --format=&#39;{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}&#39; [container-name]</pre><h3>Publishing Images to Google Artifact Registry 🌐</h3><h3>Tagging Images</h3><p>The format used to tag images in Google Artifact Registry is:</p><p>&lt;region-repository&gt;-docker.pkg.dev/my-project/my-repo/my-image “&gt;</p><pre>&lt;region-repository&gt;-docker.pkg.dev/my-project/my-repo/my-image</pre><h3>Creating a Target Docker Repository</h3><ol><li>Navigate to the Google Cloud Console.</li><li>Go to <strong>CI/CD &gt; Artifact Registry &gt; Repositories &gt; Create Repository</strong>.</li><li>Set the repository name and region.</li><li>Choose the format.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Flt3aV0fSBwckaVguxC7tA.png" /><figcaption>image of navigating to artifact registry google cloud</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5tBvDBor8LKHIKHdYZdGfQ.png" /><figcaption>image of creating a repository in artifact registry</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9GzH9ZWmlkMUGAkhNTqU7g.png" /><figcaption>image of creating a new docker repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*40ao9MlRaPvgZsbVglJkVQ.png" /><figcaption>image of configuring the new repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-q_rA153fDNTXSyeiYBSow.png" /><figcaption>image of viewing the new created repository in the artifact registry in Google Cloud</figcaption></figure><h3>Configuring Authentication</h3><p>To use the Google Cloud CLI to authenticate to Artifact Registry, run:</p><pre>gcloud auth configure-docker [region]-docker.pkg.dev</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5zMz9I4VX84E45u94gmeBg.png" /><figcaption>image of authenticating google cloud CLI to artifact registry</figcaption></figure><p>This updates the Docker configuration to connect with Artifact Registry in Google Cloud to push and pull images.</p><h3>Creating Artifact Registry Using google cloud CLI</h3><p>To create an Artifact Registry using the google cloud CLI, use:</p><pre>gcloud artifacts repositories create [repository-name] \<br>--repository-format=docker \<br>--location=[region] \<br>--description=&quot;Docker repository&quot;</pre><h3>Pushing a Container to Artifact Registry 🚀</h3><ol><li>Navigate to the directory containing the Dockerfile:</li></ol><p>cd [folder name]</p><p>2. Tag the image in the current directory with the format used in Artifact Registry:</p><p>docker build -t &quot;REGION&quot;-docker.pkg.dev/&quot;PROJECT-ID&quot;/&quot;REPOSITORY-NAME&quot;/&quot;IMAGE-NAME&quot;:&quot;TAG&quot; .</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*OYNaUlBG2zGgsx7VNpGevA.png" /><figcaption>image showing various operations on google cloud CLI before pushing a container to the artifact registry</figcaption></figure><p>3. List all images:</p><p>docker images</p><p>4. Push the image to Artifact Registry:</p><p>docker push &quot;REGION&quot;-docker.pkg.dev/&quot;PROJECT-ID&quot;/&quot;REPOSITORY-NAME&quot;/&quot;IMAGE-NAME&quot;:&quot;TAG&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QaVXyNY2EIUN6XxYheSy3g.png" /><figcaption>image showing the docker image being pushed to the google cloud artifact registry</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MYA0tkfhIvzlIgh3JRkPdw.png" /><figcaption>image showing docker image been pushed to the google artifact registry</figcaption></figure><h3>Confirming the Image Push</h3><p>Navigate to <strong>CI/CD &gt; Artifact Registry &gt; Repositories &gt; [repository-name] &gt; Images</strong> to confirm the image has been pushed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V1RtikEjasMipLTDVyX8BQ.png" /><figcaption>image of node-app docker image in the artifact registry</figcaption></figure><h3>Testing the Image 🧪</h3><h3>Simulating a Fresh Environment</h3><ol><li>Stop all containers:</li></ol><p>docker stop $(docker ps -q)</p><p>Remove all containers:</p><p>docker rm $(docker ps -a -q)</p><p>Remove all Docker images:</p><p>docker rmi &quot;REGION&quot;-docker.pkg.dev/&quot;PROJECT-ID&quot;/&quot;REPOSITORY-NAME&quot;/&quot;IMAGE-NAME&quot;:&quot;TAG&quot;</p><p>Remove the node image:</p><p>docker rmi node:lts</p><p>Remove remaining images:</p><p>docker rmi -f $(docker images -aq)</p><p>Confirm all images have been removed:</p><p>docker images</p><h3>Pulling and Running the Image</h3><p>Pull the image from Artifact Registry:</p><p>docker pull &quot;REGION&quot;-docker.pkg.dev/&quot;PROJECT-ID&quot;/&quot;REPOSITORY-NAME&quot;/&quot;IMAGE-NAME&quot;:&quot;TAG&quot;</p><p>Run a container from the pulled image:</p><p>docker run -d -p 4000:80 &quot;REGION&quot;-docker.pkg.dev/&quot;PROJECT-ID&quot;/&quot;REPOSITORY-NAME&quot;/&quot;IMAGE-NAME&quot;:&quot;TAG&quot;</p><p>Test the running container with curl:</p><p>curl <a href="http://localhost:4000/">http://localhost:4000</a></p><p>By following these steps, you can effectively debug your Docker containers and manage your images in Google Artifact Registry. Happy coding! 💻🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42ee2f8c9e77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker: Revolutionizing Application Development and Deployment ]]></title>
            <link>https://medium.com/@salemkim/docker-revolutionizing-application-development-and-deployment-59452da99e5e?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/59452da99e5e</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Sat, 24 Aug 2024 16:52:09 GMT</pubDate>
            <atom:updated>2024-08-24T16:52:09.681Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/889/0*v2M4QPc8escBHYOy" /><figcaption>image of docker</figcaption></figure><p>Docker is an open platform designed to simplify the process of developing, shipping, and running applications. By using Docker, you can separate your applications from your infrastructure, treating your infrastructure as a managed application. This separation allows for more efficient and streamlined workflows.</p><h3>Advantages of Docker 🌟</h3><ol><li><strong>Ship Code Faster</strong> 🚢</li><li><strong>Test Code Faster</strong> 🧪</li><li><strong>Deploy Code Faster</strong> 🚀</li><li><strong>Shorten the Cycle Between Writing and Running Code</strong> ⏱️</li></ol><p>Docker combines kernel containerization features with workflows and tooling that help you manage and deploy applications efficiently. One of the key benefits is that Docker applications can be directly used by Kubernetes, allowing you to run your applications in a cluster of machines.</p><h3>Getting Started with Docker in Google Cloud🛠️</h3><p>To activate your account and authorize, use:</p><pre>#gcloud auth list</pre><p>To list your project ID, use:</p><pre>#gcloud config list project</pre><h3>Running a “Hello World” Container 🌍</h3><p>When you run the hello-world container, Docker Daemon searches for the hello-world image. If it is not found locally, the image is pulled from the Docker Hub registry. A container is then created from the image and run. On subsequent runs, Docker Daemon finds the image in the local registry and runs the container from that image, avoiding the need to pull it again.</p><pre>#docker run hello-world</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dSbeP9XDUcxQIZ6jSxOXUw.png" /><figcaption>image of running hello world container</figcaption></figure><p>To list all images:</p><pre>#docker images</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PNGMZ_absifazWBjsbxLLw.png" /><figcaption>image of listing docker images</figcaption></figure><h3>Understanding Docker Image Fields 📋</h3><ul><li><strong>Repository</strong>: Name of the image</li><li><strong>Tag</strong>: Version of the image</li><li><strong>Image ID</strong>: Unique identifier (SHA256 hash) of the Docker image</li><li><strong>Created</strong>: When the image was created</li><li><strong>Size</strong>: Size of the image</li></ul><h3>Running and Managing Containers 🖥️</h3><p>To run a container:</p><pre>#docker run [image name]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*85LGSIL8XSR_4sLIh4eSLQ.png" /><figcaption>image of running hello-world container</figcaption></figure><p>To list running containers:</p><pre>#docker ps</pre><h3>Understanding Container Fields 📋</h3><ul><li><strong>Container ID</strong>: Unique identifier of the container</li><li><strong>Image</strong>: Name of the image</li><li><strong>Command</strong>: Command that is run in the container</li><li><strong>Created</strong>: When the container was created</li><li><strong>Status</strong>: Status of the container</li><li><strong>Ports</strong>: Ports exposed by the container</li><li><strong>Names</strong>: Name of the container</li></ul><p>To list all containers, including stopped ones:</p><pre>#docker ps -a</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vMNyFqBcwDUihD2TD8XmZQ.png" /><figcaption>image of listing all containers including stopped ones</figcaption></figure><h3>Building Docker Images Based on a Node Application 🛠️</h3><p><strong>Create a Folder</strong>:</p><p>#mkdir [folder name] &amp;&amp; cd [folder name]</p><p><strong>Create a Dockerfile</strong>:</p><ol><li>Dockerfile</li></ol><p>#cat &gt; Dockerfile &lt;&lt;EOF FROM node:lts WORKDIR /app ADD . /app EXPOSE 80 CMD [&quot;node&quot;, &quot;app.js&quot;] EOF</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JzoW1CHfExyVeGztKxUkkQ.png" /><figcaption>image of creating a Dockerfile</figcaption></figure><p>2. create a node application</p><p>cat &gt; app.js &lt;&lt; EOF; const http = require(&quot;http&quot;); const hostname = &quot;0.0.0.0&quot;; const port = 80; const server = http.createServer((req, res) =&gt; { res.statusCode = 200; res.setHeader(&quot;Content-Type&quot;, &quot;text/plain&quot;); res.end(&quot;Hello World\n&quot;); }); server.listen(port, hostname, () =&gt; { console.log(&quot;Server running at http://%s:%s/&quot;, hostname, port); }); process.on(&quot;SIGINT&quot;, function () { console.log(&quot;Caught interrupt signal and will exit&quot;); process.exit(); }); EOF</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DsOV_TRyXzq1_-CDCExHA.png" /><figcaption>image of creating a nodejs application</figcaption></figure><p><strong>Build the Docker Image</strong>:</p><p>#docker build -t [image-name]:[tag] .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jSqGEjPQal4WCbx-xWhPA.png" /><figcaption>image of building the node-app docker image</figcaption></figure><p><strong>List images</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YanIDEZ-XmL8lzYyubH4Lg.png" /><figcaption>image of listing the node-app image</figcaption></figure><h3>Running a Container Based on the Docker Image 🖥️</h3><p>To run the container:</p><pre>#docker run -p 4000:80 --name [container-name] [image name]:[tag]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RDmF0_pZ8hrRyb35F_XTvg.png" /><figcaption>image of running my-app-2 container based on the node-app image</figcaption></figure><p>To access the Node application in another terminal:</p><pre>#curl http://localhost:4000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dE55aKvCpydqQDfXW9VZGg.png" /><figcaption>accessing the node application on terminal</figcaption></figure><p>To stop the container:</p><pre>#docker stop [container-name]</pre><p>To remove the container:</p><pre>#docker rm [container-name]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r5Zbm8zjAK-FLgTztHDRIA.png" /></figure><p>To confirm the container has been removed:</p><pre>#docker ps -a</pre><p>To run the container in the background using the -d flag:</p><pre>#docker run -d -p 8000:80 --name [container-name] [image-name]:[tag]</pre><p>Docker simplifies the process of developing, shipping, and running applications, making it an essential tool for modern software development. Happy Dockering! 🐳</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59452da99e5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kubernetes and Docker: A Perfect Match for Containerized Applications ]]></title>
            <link>https://medium.com/@salemkim/kubernetes-and-docker-a-perfect-match-for-containerized-applications-e2c467800b9c?source=rss-228c3a9b8e2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2c467800b9c</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Salem]]></dc:creator>
            <pubDate>Fri, 23 Aug 2024 10:21:53 GMT</pubDate>
            <atom:updated>2024-08-23T10:21:53.874Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4Lhz1D-BiHpClhhBJdUHw.jpeg" /><figcaption>AI generated image of Kubernetes and Docker</figcaption></figure><p><strong>In the world of cloud computing and DevOps, Kubernetes and Docker have become indispensable tools.</strong> They revolutionize how we develop, deploy, and manage applications. But how do they work together? Let’s dive in!</p><h3>What is Docker? 🐳</h3><p><strong>Docker</strong> is a platform that enables developers to package applications and their dependencies into lightweight, portable containers. These containers can run consistently across different environments, from a developer’s laptop to production servers. Docker simplifies the development process by ensuring that the application behaves the same, regardless of where it is deployed.</p><h3>What is Kubernetes? ☸️</h3><p><strong>Kubernetes</strong>, often abbreviated as K8s, is an open-source container orchestration platform. It automates the deployment, scaling, and management of containerized applications. Kubernetes provides a robust framework to run distributed systems resiliently, handling failover, scaling, and deployment seamlessly.</p><h3>How Docker and Kubernetes Work Together 🤝</h3><p>While Docker handles the creation and packaging of containers, Kubernetes takes on the responsibility of managing and orchestrating these containers at scale. Here’s how they complement each other:</p><ul><li><strong>Containerization with Docker:</strong> Docker packages applications into containers, ensuring they include everything needed to run: code, runtime, libraries, and dependencies. This makes the application portable and consistent across different environments.</li><li><strong>Orchestration with Kubernetes:</strong> Kubernetes manages these Docker containers, automating tasks such as deployment, scaling, and load balancing. It ensures that the application runs smoothly, even as demand fluctuates or if there are hardware failures.</li></ul><h3>Key Features of Kubernetes and Docker Integration 🌟</h3><ul><li><strong>Scalability:</strong> Kubernetes can automatically scale the number of container instances based on demand, ensuring optimal performance and resource utilization.</li><li><strong>Self-Healing:</strong> Kubernetes monitors the health of containers and can restart or replace them if they fail, ensuring high availability.</li><li><strong>Load Balancing:</strong> Kubernetes distributes network traffic across multiple containers, ensuring no single container is overwhelmed.</li><li><strong>Declarative Configuration:</strong> Kubernetes uses YAML files to define the desired state of the application, making it easy to manage and version control.</li><li><strong>Rolling Updates and Rollbacks:</strong> Kubernetes allows for seamless updates to applications without downtime and can roll back to previous versions if something goes wrong.</li></ul><h3>Real-World Use Case 🌍</h3><p>Imagine a scenario where you have a web application that needs to handle varying levels of traffic. Using Docker, you package your application into a container. Kubernetes then takes over, deploying multiple instances of this container across a cluster of servers. As traffic increases, Kubernetes automatically scales up the number of containers. If a server fails, Kubernetes redistributes the load to ensure continuous availability.</p><h3>Conclusion 🎯</h3><p><strong>Docker and Kubernetes together provide a powerful combination for developing, deploying, and managing containerized applications.</strong> Docker simplifies the creation and packaging of applications, while Kubernetes automates their orchestration and management at scale. By leveraging both, you can build resilient, scalable, and efficient applications that meet the demands of modern cloud environments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2c467800b9c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>