☀️
Yellow Team
  • Welcome
    • Welcome
  • Training
    • Cloud Academy
      • Azure
        • Azure Sentinel Incident Triage Challenge
      • Kubernetes
        • Mastering Kubernetes Pod Configuration: Defining Resource Requirements
        • Mastering Kubernetes Pod Configuration: Security Contexts
        • Mastering Kubernetes Pod Configuration: Persistent Data
        • Mastering Kubernetes Pod Configuration: Config Maps and Secrets
        • Mastering Kubernetes Pod Configuration: Service Accounts
        • Create Kubernetes Nginx Ingress Controller for External API Traffic
        • Create Kubernetes Layer-7 Network Policies using Cilium CNI
    • Cloud Guru
      • Certified Kubernetes Administrator (CKA)
        • Certified Kubernetes Administrator (CKA) Practice Exam: Part 1
        • Certified Kubernetes Administrator (CKA) Practice Exam: Part 2
        • Certified Kubernetes Administrator (CKA) Practice Exam: Part 3
        • Certified Kubernetes Administrator (CKA) Practice Exam: Part 4
      • Introduction to Kubernetes
        • Building a Kubernetes 1.27 Cluster with kubeadm
        • Working with Kubernetes Using kubectl
        • Running Containers with Kubernetes
      • Kubernetes Essentials
        • Deploying a Simple Service to Kubernetes
        • Deploying a Microservice Application to Kubernetes
      • Learn Kubernetes by Doing
        • Creating a Kubernetes Cluster
        • Deploying a Pod to a Node with a Label in Kubernetes
        • Creating a Service and Discovering DNS Names in Kubernetes
        • Scheduling Pods with Taints and Tolerations in Kubernetes
      • AWS
        • Creating an AWS CodeCommit Repository That Triggers Email Notifications
      • Docker
        • Deploying a Docker Container with Jenkins Pipelines
Powered by GitBook
On this page
  • Use kubectl to Check the Status of Worker Nodes in the Cluster
  • Get a List of Pods Running in the Cluster
  • Delete an Existing Pod
  • Create a New Pod
  1. Training
  2. Cloud Guru
  3. Introduction to Kubernetes

Working with Kubernetes Using kubectl

PreviousBuilding a Kubernetes 1.27 Cluster with kubeadmNextRunning Containers with Kubernetes

Last updated 1 year ago

Use kubectl to Check the Status of Worker Nodes in the Cluster

  • Use kubectl to list all nodes in the cluster

  • Verify the nodes are in the READY state

Get a List of Pods Running in the Cluster

  • Use kubectl to list Pods in all namespaces

  • Verify whether or not these Pods are all up and running

kubectl get pods --all-namespaces

Delete an Existing Pod

  • Delete the Pod named web-frontend

kubectl delete pod web-frontend
kubectl get pods --all-namespaces

Create a New Pod

  • Create a new Pod called web-frontend

  • Make it run a container with the nginx image

vi web-frontend.yml

web-frontend.yml

apiVersion: v1
kind: Pod
metadata:
    name: web-frontend
spec:
    containers:
    - name: nginx
      image: nginx    
kubectl create -f web-frontend.yml
kubectl get pods --all-namespaces