{"id":9141,"date":"2025-07-11T18:55:32","date_gmt":"2025-07-11T13:25:32","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=9141"},"modified":"2026-08-28T15:46:16","modified_gmt":"2026-08-28T10:16:16","slug":"how-to-create-a-pod-in-a-kubernetes-cluster","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-create-a-pod-in-a-kubernetes-cluster\/","title":{"rendered":"How to Create a Pod in a Kubernetes Cluster"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Kubernetes is a powerful platform for managing containerized applications. At the heart of Kubernetes is the <strong>Pod<\/strong> \u2014 the smallest and simplest unit you can deploy. A pod can run one or more containers, and those containers share the same resources, like network and storage. In most cases, a pod runs just a single container. Pods make it easier to manage and run applications by grouping containers that need to work closely together.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog, we\u2019ll show you how to create a basic pod in a Kubernetes cluster using a YAML file and the <code>kubectl<\/code>command-line tool.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">PreRequisites<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Ensure the following before proceeding:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A running Kubernetes cluster (via Minikube, KOPS, or a cloud provider like GKE, EKS, or AKS)<\/li>\n\n\n\n<li><code>kubectl<\/code> CLI tool installed and configured<\/li>\n\n\n\n<li>Basic knowledge of YAML and terminal commands<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to Create a Pod in Kubernetes<br>Step 1: Create a YAML File<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Create a file called <code>apache-pod.yaml<\/code> and paste the following:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>apiVersion: v1\nkind: Pod\nmetadata:\nname: apache-pod\nspec:\ncontainers:\n-  name: apache-container\n   image: httpd:latest\n   ports:\n   -  containerPort: 80<\/code><\/pre>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">This configuration defines a pod name <code>apache-pod<\/code> that runs an Apache HTTP server on port 80.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Deploy the Pod<br><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following command to create the pod:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>kubectl apply -f apache-pod.yaml<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Expected output:<\/strong><\/p>\n<\/blockquote>\n<\/blockquote>\n\n\n\n<pre class=\"wp-block-code\"><code>pod\/apache-pod created<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Verify Pod Status<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Check the pod\u2019s current status:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl get pods<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Sample output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>NAME          READY   STATUS    RESTARTS   AGE\napache-pod    1\/1     Running   0          30s<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Access the Pod<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To access the container shell:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl exec -it apache-pod -- bash<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You can now interact with the container, check logs, or test services inside.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: Delete the Pod<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Once you&#8217;re done testing, you can clean up with below commands<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>kubectl delete pod apache-pod<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Creating a Pod in Kubernetes is your first step toward mastering container orchestration. With just a YAML file and a few kubectl commands, you can deploy containers into your cluster.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While individual Pods are great for testing, for real-world production use, it\u2019s better to use higher-level objects like <strong>Deployments<\/strong> and <strong>ReplicaSets<\/strong> that offer resilience and scaling.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Kubernetes is a powerful platform for managing containerized applications. At the heart of Kubernetes is the Pod \u2014 the [&hellip;]<\/p>\n","protected":false},"author":510,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1020],"tags":[855,1068],"class_list":["post-9141","post","type-post","status-publish","format-standard","hentry","category-containers-kubernetes","tag-kubernetes","tag-pod","psol-cat-containers-kubernetes"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-2nr","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9141","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/510"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=9141"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9141\/revisions"}],"predecessor-version":[{"id":11128,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/9141\/revisions\/11128"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=9141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=9141"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=9141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}