Tech with Tyler
LinkedInGitHubYouTube
  • 👋Welcome!
    • whoami
    • !!! Disclaimer !!!
  • 🎓Academy
    • AWS Security Cookbook
      • AWS Control Tower
        • Lab: Deploying AWS Control Tower via Terraform
        • Lab: Blocking Regions with AWS Control Tower
      • AWS CloudTrail
      • AWS GuardDuty
        • Lab: Deploying AWS GuardDuty via Terraform
        • Lab: Logging GuardDuty Findings to S3
        • Lab: Adversary Simulation Detection with Stratus Red Team and GuardDuty
      • AWS Organizations
        • Lab: Deploying AWS Organizations via Terraform
      • AWS Root Account Management
        • Lab: Deploying AWS Root Account Management via Terraform
      • AWS Service Control Policies (SCPs)
        • Lab: Deploying AWS Service Control Policies (SCPs) via Terraform
      • TBD - Coming Soon!
        • [TBD] AWS Account Factory
        • [TBD] AWS Identity Center
    • My content on Cybr
      • Course - Terraform on AWS: From Zero to Cloud Infrastructure
      • Lab - Create Static AWS S3 Website with Terraform
      • Lab - Secure EC2 Access with SSM Session Manager and KMS
      • Lab - Encrypt and Decrypt Data with KMS and Data Encryption Keys
    • My content on PwnedLabs
      • Cyber Range - Electra
      • Lab - Abusing Identity Providers in AWS
      • Lab - Prowler and AWS Security Hub
      • Blog - Abusing Identity Providers in AWS
      • Blog - Building Security Guardrails with AWS Resource Control Policies
      • Blog - Defending Against the whoAMI Attack with AWS Declarative Policies
    • My content on YouTube
      • AWS Security Engineering
      • Linux in 60 Seconds!
  • ☁️Cloud Security
    • AWS Attacks and Techniques
      • Enumerate AWS Account IDs
      • Enumerate AWS IAM Users
      • Enumerate (Unauthenticated) IAM Users and Roles
      • Enumerate AWS Public Resources
      • Enumerate Secrets in AWS
      • Generate AWS Console Session
      • Generate IAM Access Keys from CloudShell
      • Password Spraying AWS IAM Users
      • Subdomain Takeovers
    • AWS Privilege Escalation
      • Identity Access Management (IAM)
      • IAM Trust Policies
      • Key Management Service (KMS)
      • Lightsail
      • OpenID Connect (OIDC)
      • S3
      • Secrets Manager
      • Security Token Service (STS)
    • AWS General Info
      • Amazon Bedrock
      • EC2
      • KMS
      • S3
      • SNS Topic
    • AWS CLI Cheat Sheet
    • Capture the Flags (CTFs)
      • Flaws.Cloud
        • Level 1
        • Level 2
        • Level 3
        • Level 4
        • Level 5
        • Level 6
      • PwnedLabs
        • Escalate Privileges by IAM Policy Rollback
        • Exploiting Weak S3 Bucket Policies
        • Leveraging S3 Bucket Versioning
        • S3 Enumeration Basics
        • Pillage Exposed RDS Instances
        • EC2 SSRF Attack
        • Hunt for Secrets in Git Repos
      • Cybr
        • Challenge - Secrets Unleashed
    • Tools
      • Tooling Index
      • dsnap
      • Pacu
      • s3-account-search
      • GoAWSConsoleSpray
      • aws_consoler
      • cloudenum
  • 📦Containers & Orchestration
    • Kubernetes
  • 👨‍💻Coding & CLI Tooling
    • CLI Tools
      • AWS CLI
      • Git
      • GitHub Copilot (CLI)
      • Homebrew
      • jq
      • ngrok
      • ssh
    • Coding and Scripting
      • Bash
      • Python
    • Terminal Customization
  • ⚙️DevSecOps
    • CI/CD
      • GitLab
    • Hashicorp Terraform
    • Hashicorp Vault
    • IAC Scanning
      • tfsec
    • Secrets Scanning
      • Trufflehog
  • 🎁Miscellaneous
    • Jenkins
  • 💻Operating Systems
    • Linux
      • APT Package Manager
      • CLI Tools Cheat Sheet
      • Man Pages
      • Services
      • Users and Groups
  • 🏗️Projects
    • Active Directory Homelab Automation
    • AWS Cloud Resume Challenge
    • Proxmox Homelab as Code
  • 📌Other
    • Useful Resources
Powered by GitBook
On this page
  • What is Kubernetes?
  • Kubernetes Terminology
  • Kubernetes Deployment Example
  • Kubernetes Cheat Sheet
  • Useful Resources

Was this helpful?

  1. Containers & Orchestration

Kubernetes

A brief overview of Kubernetes

What is Kubernetes?

  • Kubernetes is a container orchestration platform designed to automate the deployment, scaling, and management of containerized applications.

Kubernetes Terminology

  • An application gets deployed (encapsulated) into a Pod which is a single instance of an application

  • Pods exist on a Node

  • Multiple Nodes form a Cluster

Kubernetes Deployment Example

  • A Kubernetes Deployment file is created in YAML and provides a declarative way to specify the desired state of an application and its associated resources

# A basic Kubernetes deployment file that deploys 2 (replicas) containers

apiVersion: apps/v1
kind: Deployment
metadata:
  name: tylers-deployment
  labels:
    app: tylers-app
spec:
  template:
    metadata:
      name: tylers-pod
      lables:
        app: tylers-app
      spec:
        containers:
          - name: tylers-container
            image: alpine:latest
  replicas: 2
  selector:
    matchLabels:
      app: tylers-app

Kubernetes Cheat Sheet

  • A handy list of common Kubernetes commands organized by type

Deployment Commands

# Deploy a container on a Pod
kubectl run <nameOfPod> --image <nameOfTheImageFromYourImageRepo>
	# kubectl run nginx --image nginx

# Deploy from a yaml file (apply and create are interchangable)
kubectl apply -f <fileName>.yaml

# Deploy a deployment type file
kubectl apply -f <fileName>.yaml

# View deployment
kubectl get deployments

# Edit a deployment
kubectl edit deployments <deploymentName>

# Apply a new update
kubectl apply -f <fileName>.yaml

# View deployment status
kubectl rollout status deployment/<deploymentName>

# View deployment history
kubectl rollout history deployment/<deploymentName>

# Rollback a deployment
kubectl rollout undo deployment/<deploymentName>

Node Commands

# Get nodes in cluster
kubectl get nodes

# Get OS of running nodes
kubectl get nodes --output wide # other options exist too e.g., json'

Pod Commands

# Get Pods
kubectl get pods

# Get details of a Pod
kubectl describe pods # <podName>

# Delete a pod (or pods if more than one is specified)
kubectl delete pod <podName> # <podName2> <podName3>

Replica Commands

# Get number of replicasets
kubectl get replicasets

# Get details of replicasets
kubectl describe replicasets # <replicaset name>

# Delete a replicaset (or sets if more than one is specified)
kubectl delete replicasets <replicasetName> # <replicasetName2>

# Edit an existing replicaset (this should take effect after changing the file)
kubectl edit replicasets <replicasetName> # then change the number to replicate

Service Commands

# Create a service
kubectl create -f <serviceDefinitionFile>

# View services
kubectl get serivces 

Troubleshooting Commands

# View pod logs
kubectl logs <podName> -n <namespace>

Useful Resources

PreviouscloudenumNextCLI Tools

Last updated 1 year ago

Was this helpful?

📦
Kubernetes DocumentationKubernetes
Logo