You are on page 1of 12

KUBERNETES CHEATSHEET

Kubernetes Cheatsheet
TABLE OF CONTENTS

Preface 1
Introduction 1
Kubernetes Basics 1
Quick Reference Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Architecture Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Essential Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Pods and Containers 2
Cheat sheet table: Common commands for creating, managing, and troubleshooting pods . . . . . . . . . . . . 2
Best practices for effective containerization within the Kubernetes environment . . . . . . . . . . . . . . . . . . . . 2
Code snippets for creating multi-container pods. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Deployments and ReplicaSets 3
Visual guide: Lifecycle of Deployments and how ReplicaSets ensure high availability. . . . . . . . . . . . . . . . . 4
Cheat sheet for scaling applications with Deployments and managing rolling updates . . . . . . . . . . . . . . . . 4
Code examples for creating and updating ReplicaSets. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Services and Networking 5
Graphical representation: Kubernetes networking components and their interactions. . . . . . . . . . . . . . . . 5
Cheat sheet for creating and managing Kubernetes services. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
YAML examples for defining Services and exposing applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Configuration and Secrets 6
Key configurations in Kubernetes and practical use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Secure practices for managing and consuming secrets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Code snippets for using ConfigMaps and Secrets in Kubernetes pods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Monitoring and Troubleshooting 7
Cheat sheet for troubleshooting common issues in Kubernetes clusters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Visual representation of Kubernetes dashboard components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Advanced Topics 8
Cheat sheet for Helm charts and efficient package management in Kubernetes . . . . . . . . . . . . . . . . . . . . . . 8
Code examples for setting up Persistent Volumes and Persistent Volume Claims . . . . . . . . . . . . . . . . . . . . . 8
Additional Commands 9
For Node Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
For Namespace Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Service Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Deployment Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Resources 10

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


1 KUBERNETES CHEATSHEET

PREFACE
PREFACE Term Meaning

Welcome to the Kubernetes Cheatsheet! In this Pod Smallest deployable unit


cheatsheet, you’ll find essential commands, in Kubernetes.
concepts, and configurations to help you navigate Node A physical or virtual
and leverage Kubernetes effectively. Whether machine in a cluster.
you’re a beginner exploring containerization or a
Deployment Describes the desired
seasoned DevOps professional, this cheatsheet aims
state for a set of pods.
to provide quick references and reminders for
common Kubernetes tasks, enabling you to Service Defines a set of pods and
streamline your workflow and harness the full a policy for accessing
potential of containerized environments. them.

Labels Key-value pairs attached


INTRODUCTION
INTRODUCTION to objects, allowing for
flexible categorization
Kubernetes, commonly referred to as K8s, is a and selection. Used for
widely adopted container orchestration platform identifying and
that simplifies the deployment, scaling, and grouping related
management of containerized applications. resources.

In the traditional model, deploying applications Master The control plane in


across different environments posed challenges due Kubernetes, managing
to variations in infrastructure and configurations. the overall state of the
Kubernetes addresses these challenges by providing cluster. Components
a unified platform that abstracts away the include the API server,
complexities of the underlying infrastructure. It etcd, controller
allows developers to deploy and manage manager, and scheduler.
applications consistently across various
environments, fostering portability and scalability.
ARCHITECTURE OVERVIEW
Kubernetes, like Docker, emphasizes the use of Kubernetes operates on a client-server architecture,
container technology. However, while Docker comprising a control plane and a set of nodes
focuses on packaging and distribution, Kubernetes where containers run.
takes containerization to the next level by
providing tools for automating deployment, scaling,
and operations.

A Kubernetes cheat sheet is a must-have, providing


quick access to essential commands for seamless
deployment management. Let’s look at it as your go-
to guide in the fast-paced Kubernetes environment,
enhancing productivity, minimizing errors, and
ensuring efficient navigation through complex
Figure 1. Architecture Overview
tasks.

KUBERNETESBASICS
BASICS ESSENTIAL COMMANDS
KUBERNETES
With a foundational understanding of terms and
QUICK REFERENCE TABLE architecture, let’s equip ourselves with essential
commands for managing Kubernetes clusters.
The quick reference table below serves as a
compass for navigating the terminology crucial to These commands are crucial for understanding the
mastering Kubernetes. status, configuration, and available resources
within a Kubernetes cluster. They provide a quick

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


2 KUBERNETES CHEATSHEET

overview of the cluster’s information, version, Command Description


configuration, available API resources, and
kubectl get pods List all pods in the
versions.
default namespace.

Command Description kubectl get pods --all List all pods in all
-namespaces namespaces.
kubectl cluster-info Display endpoint
information about the kubectl describe pod Display detailed
master and services in <pod_name> information about a
the cluster. specific pod.
kubectl version Display the Kubernetes kubectl logs <pod_name> View the logs of a
version running on the specific pod.
client and server. kubectl exec -it Open an interactive
kubectl config view <pod_name> — /bin/bash
Get the configuration of shell inside a running
the cluster. container.
kubectl api-resources List the API resources kubectl delete pod Delete a specific pod.
that are available. <pod_name>
kubectl apply -f Apply the configuration
kubectl api-versions List the API versions <pod_configuration> specified in a YAML file
that are available.
to create or update a
kubectl get all --all List everything in all pod.
-namespaces namespaces.
kubectl port-forward Forward ports from a
<pod_name> pod to your local
PODSAND
PODS ANDCONTAINERS
CONTAINERS <local_port>:<pod_port>
machine.

A Pod is the smallest deployable unit in Kubernetes,


representing a single instance of a running process BEST PRACTICES FOR EFFECTIVE
CONTAINERIZATION WITHIN THE
in a cluster. Pods are the basic building blocks and
can contain one or more containers that share the KUBERNETES ENVIRONMENT
same network namespace, allowing them to
Effective containerization is crucial for smooth
communicate with each other using localhost.
application deployment and management in a
A Container is a lightweight, standalone, and Kubernetes environment. Here are key best
executable software package that includes practices to optimize your containerized
everything needed to run a piece of software, applications:
including the code, runtime, libraries, and system
• Adhere to the Single Responsibility Principle,
tools. Containers provide a consistent and isolated
ensuring each container has a specific and
environment for applications, ensuring that they
well-defined role. This promotes modularity
run consistently across different environments.
and simplifies maintenance.

CHEAT SHEET TABLE: COMMON • Minimize the size of your container images by
COMMANDS FOR CREATING, MANAGING, reducing unnecessary layers and dependencies.
AND TROUBLESHOOTING PODS Smaller images improve deployment speed and
reduce resource consumption.

Command Description • Leverage environment variables to configure


kubectl apply -f your application. This enhances flexibility,
Apply the configuration
<pod_configuration> making it easier to adjust settings without
specified in a YAML file
modifying the container image.
to create or update a
pod. • Implement health probes within your
application to enable Kubernetes to assess its
health. This helps in automated healing and

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


3 KUBERNETES CHEATSHEET

ensures reliable application performance. - name: main-container


image: main-image:latest
• Set resource limits, such as CPU and memory, to
prevent containers from consuming excessive ports:
resources. This ensures fair resource allocation - containerPort: 80
and prevents one misbehaving container from - name: ambassador-container
impacting others on the same node. image: ambassador-image:latest
ports:
CODE SNIPPETS FOR CREATING MULTI- - containerPort: 8080
CONTAINER PODS

Using multi-container pods in Kubernetes allows Adapter Pattern


for enhanced collaboration and resource sharing
between containers within the same pod. Here are The adapter container transforms or adapts data
code snippets demonstrating different multi- before it reaches the main application, providing a
container patterns. seamless integration point.

Sidecar Pattern apiVersion: v1


The sidecar container runs alongside the main
kind: Pod
application container, providing additional metadata:
functionalities without altering the core name: adapter-pod
application. spec:
containers:
- name: main-container
apiVersion: v1 image: main-image:latest
kind: Pod ports:
metadata: - containerPort: 80
name: multi-container-pod - name: adapter-container
spec: image: adapter-image:latest
containers: ports:
- name: main-container - containerPort: 9090
image: main-image:latest
ports:
- containerPort: 80 DEPLOYMENTSAND
DEPLOYMENTS ANDREPLICASETS
REPLICASETS
- name: sidecar-container
image: sidecar-image:latest Deployments and ReplicaSets are fundamental
components in Kubernetes that play an important
role in managing the deployment, scaling, and
Ambassador Pattern update lifecycle of applications within a cluster.

In this pattern, the ambassador container acts as an A Deployment is a higher-level abstraction in


intermediary, handling communication and Kubernetes that facilitates the declarative definition
network-related tasks on behalf of the main of application lifecycles.
application.
A ReplicaSet is closely tied to Deployments and acts
as a controller, ensuring a specified number of
apiVersion: v1 identical pod replicas are running at all times.
kind: Pod
metadata:
name: ambassador-pod
spec:
containers:

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


4 KUBERNETES CHEATSHEET

VISUAL GUIDE: LIFECYCLE OF Rollback to Previous Version: kubectl rollout undo


DEPLOYMENTS AND HOW REPLICASETS deployment/<deployment_name>

ENSURE HIGH AVAILABILITY


Pause and Resume Rolling Updates: kubectl rollout
pause deployment/<deployment_name> and kubectl
Deployments in Kubernetes manage the
rollout resume deployment/<deployment_name>
deployment and scaling of pods, providing a
declarative approach to defining the desired state. Customize Update Strategy (e.g., Canary
The life cycle involves several key stages: Deployment): kubectl apply -f canary-deployment-
strategy.yaml
• Creation: A Deployment is created with the
desired number of replicas and pod template These commands offer a quick reference for scaling
specifications. deployments to meet demand and efficiently
managing rolling updates. Whether adjusting the
• ReplicaSet Generation: The Deployment
number of replicas or orchestrating updates with
creates an associated ReplicaSet, which ensures
different strategies, this cheat sheet helps
the specified number of pod replicas are
streamline the deployment process within a
running.
Kubernetes environment.
• Pod Creation: The ReplicaSet creates
individual pods based on the defined template.
CODE EXAMPLES FOR CREATING AND
• Scaling: Scaling can occur by adjusting the UPDATING REPLICASETS
desired number of replicas. The Deployment
ensures the correct number of pods are Creating a ReplicaSet
maintained.

• Rolling Updates: When updating the


apiVersion: apps/v1
application, the Deployment creates a new
kind: ReplicaSet
ReplicaSet with the updated configuration
metadata:
while gradually scaling down the old
ReplicaSet.
name: example-replicaset
spec:
• Termination: The old ReplicaSet is eventually
replicas: 3
scaled to zero, and the update is complete.
selector:
matchLabels:
CHEAT SHEET FOR SCALING app: example
APPLICATIONS WITH DEPLOYMENTS template:
AND MANAGING ROLLING UPDATES
metadata:
labels:
Scaling Deployments
app: example
Scale to a Specific Number of Replicas: kubectl spec:
scale deployment <deployment_name> containers:
--replicas=<num> - name: app-container
Autoscale Based on CPU Utilization: kubectl
image: example-image:latest
autoscale deployment <deployment_name> --cpu
-percent=<percentage> --min=<min_replicas>
--max=<max_replicas> • This YAML configuration defines a ReplicaSet
named example-replicaset.
Managing Rolling Updates • It specifies that three replicas of the pod should
be maintained.
Update Deployment with a New Image: kubectl set
image deployment/<deployment_name> • The pod template includes a container named
<container_name>=<new_image> app-container using the example-image:latest
image.
Monitor Rolling Update Progress: kubectl rollout
status deployment/<deployment_name>

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


5 KUBERNETES CHEATSHEET

Updating a ReplicaSet

apiVersion: apps/v1
kind: ReplicaSet
metadata:
name: example-replicaset
spec:
replicas: 5 # Update the number
of replicas
selector:
matchLabels: Figure 2. Kubernetes Networking Components
app: example
template:
CHEAT SHEET FOR CREATING AND
metadata: MANAGING KUBERNETES SERVICES
labels:
app: example Creating Services
spec:
containers: Create a Service from a YAML file: kubectl apply -f
service-definition.yaml
- name: app-container
image: updated-example- Example* service-definition.yaml:*
image:latest # Update the container
image
apiVersion: v1
kind: Service
• This YAML configuration updates the existing
metadata:
ReplicaSet named example-replicaset.
name: example-service
• It modifies the desired number of replicas to 5. spec:
• The pod template is updated to use the selector:
updated-example-image:latest container image. app: example
ports:
SERVICESAND
SERVICES ANDNETWORKING
NETWORKING - protocol: TCP
port: 80
Services define a stable endpoint for accessing a set targetPort: 8080
of pods, while Networking encompasses the type: ClusterIP
mechanisms that enable effective communication
between these pods.
Managing Services
GRAPHICAL REPRESENTATION:
List all Services in the default namespace: kubectl
KUBERNETES NETWORKING
get services
COMPONENTS AND THEIR
INTERACTIONS Delete a Service: kubectl delete service
<service_name>

Expose a Deployment as a Service: kubectl expose


deployment <deployment_name>
--port=<external_port>

Service Discovery

Discover service details: kubectl describe service

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


6 KUBERNETES CHEATSHEET

<service_name> • It selects pods labeled app: example.

Retrieve the ClusterIP of a Service: kubectl get • The service exposes port 80 on each node,
service <service_name> -o forwarding traffic to the selected pods on port
jsonpath='{.spec.clusterIP}' 8080.

YAML EXAMPLES FOR DEFINING LoadBalancer Service


SERVICES AND EXPOSING APPLICATIONS

ClusterIP Service apiVersion: v1


kind: Service
metadata:
apiVersion: v1 name: loadbalancer-service
kind: Service spec:
metadata: selector:
name: clusterip-service app: example
spec: ports:
selector: - protocol: TCP
app: example port: 80
ports: targetPort: 8080
- protocol: TCP type: LoadBalancer
port: 80
targetPort: 8080
• This YAML configuration defines a
type: ClusterIP
LoadBalancer service named loadbalancer-
service.
• This YAML configuration defines a ClusterIP
• It selects pods labeled app: example.
service named clusterip-service.
• The service exposes port 80, and in cloud
• It selects pods with the label app: example.
environments, a cloud-specific load balancer is
• The service exposes port 80 internally and provisioned to distribute traffic to the selected
routes traffic to the pods' port 8080. pods.

NodePort Service CONFIGURATIONAND


CONFIGURATION ANDSECRETS
SECRETS

ConfigMaps allow central management of non-


apiVersion: v1 sensitive configuration details, while Secrets
kind: Service provide a secure mechanism for storing sensitive
metadata: information such as passwords.
name: nodeport-service
spec: KEY CONFIGURATIONS IN KUBERNETES
selector: AND PRACTICAL USE CASES
app: example
ports: Configuration Use Case
- protocol: TCP ConfigMaps Centralized
port: 80 configuration
targetPort: 8080 management for
type: NodePort applications.

Secrets Securely store sensitive


• This YAML configuration creates a NodePort information like
service named nodeport-service. passwords.

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


7 KUBERNETES CHEATSHEET

Configuration Use Case - configMapRef:


name: example-configmap
Resource Limits Restrict resource
consumption by
containers. • This YAML configuration defines a pod named
configmap-pod.
Environment Variables Pass configuration
details to containers. • The envFrom field references a ConfigMap
named example-configmap.
Volume Mounts Share files and
directories between • The values from the ConfigMap are injected as
containers and pods. environment variables into the pod.

Labels and Annotations Metadata for organizing


and querying objects in Using Secrets in a Pod
Kubernetes.

apiVersion: v1
SECURE PRACTICES FOR MANAGING AND kind: Pod
CONSUMING SECRETS metadata:
name: secret-pod
• Use Kubernetes Secrets: Leverage the built-in
spec:
Kubernetes Secrets API to store sensitive
information securely.
containers:
- name: app-container
• Encrypt Data in Transit: Ensure that data image: app-image:latest
exchanged between components is encrypted,
envFrom:
especially when dealing with sensitive
- secretRef:
information.
name: example-secret
• Role-Based Access Control (RBAC): Implement
RBAC to control access to Secrets, allowing only
authorized entities to retrieve sensitive data. • This YAML configuration creates a pod named
secret-pod.
• Avoid Hardcoding Secrets: Refrain from
hardcoding secrets directly in application code • The envFrom field references a Secret named
or configuration files. example-secret.

• Regularly Rotate Secrets: Periodically rotate • The values from the Secret are injected as
passwords and cryptographic keys to minimize environment variables into the pod.
the impact of a potential security breach.
Creating ConfigMap
CODE SNIPPETS FOR USING CONFIGMAPS kubectl create configmap example-configmap --from
AND SECRETS IN KUBERNETES PODS -literal=key1=value1 --from-literal=key2=value2

Using ConfigMaps in a Pod • This command creates a ConfigMap named


example-configmap.

• It includes key-value pairs (key1=value1 and


apiVersion: v1
key2=value2) that can be accessed by pods
kind: Pod
referencing this ConfigMap.
metadata:
name: configmap-pod MONITORINGAND
AND
spec:
MONITORING
TROUBLESHOOTING
TROUBLESHOOTING
containers:
- name: app-container Monitoring and troubleshooting in Kubernetes
image: app-image:latest involve the continuous observation and resolution
envFrom: of issues within a cluster. Monitoring tools like

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


8 KUBERNETES CHEATSHEET

Prometheus, Grafana, and cAdvisor provide


insights into cluster health, while troubleshooting
involves identifying and addressing common issues
in pods, nodes, networking, and services.

CHEAT SHEET FOR TROUBLESHOOTING


COMMON ISSUES IN KUBERNETES
CLUSTERS

• Pod Issues:
Figure 3. Kubernetes Dashboard
◦ Check pod logs: kubectl logs <pod_name>

◦ Describe pod for detailed info: kubectl ADVANCEDTOPICS


TOPICS
ADVANCED
describe pod <pod_name>

• Node Issues:
CHEAT SHEET FOR HELM CHARTS AND
◦ View nodes: kubectl get nodes EFFICIENT PACKAGE MANAGEMENT IN
KUBERNETES
◦ Check node events: kubectl describe node
<node_name>
Install Helm: curl
• Networking Issues: https://raw.githubusercontent.com/helm/helm/
master/scripts/get-helm-3 | bash
◦ Inspect network policies: kubectl get
networkpolicies Add Helm Repository: helm repo add stable
https://charts.helm.sh/stable
• Service Issues:
Install a Helm Chart: helm install my-release
◦ Verify service status: kubectl get services
stable/<chart_name>
• Configuration Issues:
Upgrade a Helm Release: helm upgrade my-release
◦ Check ConfigMaps: kubectl get configmaps stable/<chart_name>
• Resource Issues:
Uninstall a Helm Release: helm uninstall my-
◦ View resource usage: kubectl top nodes or release
kubectl top pods

• Cluster Information:
CODE EXAMPLES FOR SETTING UP
PERSISTENT VOLUMES AND PERSISTENT
◦ Get cluster information: kubectl cluster- VOLUME CLAIMS
info

• API Resources: Define Persistent Volume (example-pv.yaml)

◦ List available API resources: kubectl api-


resources apiVersion: v1
• Version Information: kind: PersistentVolume
metadata:
◦ Check Kubernetes version: kubectl version
name: example-pv
spec:
VISUAL REPRESENTATION OF
capacity:
KUBERNETES DASHBOARD COMPONENTS
storage: 1Gi
accessModes:
- ReadWriteOnce
hostPath:
path: /path/to/host/folder

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


9 KUBERNETES CHEATSHEET

Defines a Persistent Volume named example-pv ADDITIONAL


ADDITIONALCOMMANDS
COMMANDS
with a capacity of 1Gi using a host path.

FOR NODE MANAGEMENT


Create Persistent Volume Claim (example-
pvc.yaml) Nodes in Kubernetes are the physical or virtual
machines that form the cluster’s computing
infrastructure. These commands allow users to
apiVersion: v1 inspect, label, and manage nodes for optimal
kind: PersistentVolumeClaim cluster performance.
metadata:
name: example-pvc Command Description
spec: kubectl get nodes Display information
accessModes: about nodes in the
- ReadWriteOnce cluster.
resources:
kubectl describe node Show detailed
requests: <node_name> information about a
storage: 1Gi
specific node.
kubectl label nodes Attach a label to a node
Creates a Persistent Volume Claim named example- <node_name> <label> for categorization.
pvc requesting 1Gi storage with ReadWriteOnce
kubectl cordon Mark a node as
access.
<node_name> unschedulable for
maintenance.
Use Persistent Volume Claim in Pod (example-
pod.yaml) kubectl uncordon Allow a previously
<node_name> unschedulable node to
schedule pods.
apiVersion: v1
kubectl drain Safely evict all pods
kind: Pod <node_name> from a node before
metadata:
maintenance.
name: example-pod
spec:
containers: FOR NAMESPACE MANAGEMENT
- name: app-container
Namespaces in Kubernetes are virtual clusters
image: app-image:latest within a physical cluster, providing isolation and
volumeMounts: organization. These commands facilitate the
- mountPath: /app/data management of namespaces, enabling users to
name: data-volume create and inspect them.
volumes:
- name: data-volume Command Description
persistentVolumeClaim: kubectl get namespaces List all namespaces in
claimName: example-pvc the cluster.
kubectl create Create a new
• Defines a Pod named example-pod with a namespace namespace.
<namespace_name>
container using the specified image.
kubectl describe Show details about a
• Mounts a volume (data-volume) using the namespace specific namespace.
Persistent Volume Claim (example-pvc). <namespace_name>

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


10 KUBERNETES CHEATSHEET

SERVICE COMMANDS As your next steps, consider applying these


learnings in practical scenarios, experimenting
Services in Kubernetes provide a stable endpoint to with different configurations, and exploring
access a set of pods. These commands aid in the additional Kubernetes features. Stay informed
management of services, allowing users to expose about updates in the Kubernetes ecosystem,
deployments and handle service configurations. continuously refine your skills, and consider
contributing to the community.
Command Description
kubectl get services List all services in the
RESOURCES
RESOURCES
default namespace.
These resources cover a wide range of topics and
kubectl get services List all services in all cater to different levels of expertise, helping you
--all-namespaces namespaces. deepen your understanding of Kubernetes.
kubectl describe Display detailed
service <service_name> information about a • Kubernetes Monitoring
service. ◦ Website: Understanding Kubernetes
kubectl expose Expose a deployment as Monitoring
deployment a service.
<deployment_name> ◦ A comprehensive guide that covers the
--port=<external_port> basics and advanced concepts of
Kubernetes Monitoring
kubectl delete service Delete a specific service.
<service_name> • Kubernetes monitoring tools

◦ Website: Best Kubernetes monitoring tools


DEPLOYMENT COMMANDS
◦ A Listicle article that listed 13+ opensource
Deployments in Kubernetes define the desired state and free Kubernetes monitoring tools
for a set of pods. These commands assist in the • Kubernetes Logging
management of deployments, allowing users to
scale, inspect, and modify deployment ◦ Website: Kubernetes Logging 101: A
configurations. Complete Guide

◦ The article talks about K8s logging, various


Command Description logging methods, best practices and tools in
kubectl get deployments List all deployments in an easy to read way.

the default namespace. • Official Kubernetes Documentation


kubectl get deployments List all deployments in ◦ Website: Kubernetes Documentation
--all-namespaces all namespaces.
◦ The official site of Kubernetes.
kubectl describe Show details about a
deployment • Official Kubernetes Blog
specific deployment.
<deployment_name>
◦ Website: Kubernetes Blog
kubectl scale Scale the number of
deployment ◦ Learn all about Kubernetes, be it logging,
replicas in a
<deployment_name> monitoring, configuring, or anything else.
--replicas=<num> deployment.
• Kubectl Cheat Sheet

In this comprehensive Kubernetes cheat sheet, ◦ Website: kubectl Quick Reference


we’ve delved into fundamental concepts, advanced
◦ A handy reference for kubectl commands,
techniques, and essential commands for efficient
the primary CLI tool for interacting with
cluster management. From basic terminology and
Kubernetes clusters.
architecture to intricate configurations, monitoring,
and troubleshooting, this resource serves as a • Kubernetes Patterns
valuable quick reference. ◦ Website: Kubernetes Patterns, 2nd Edition

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!


11 KUBERNETES CHEATSHEET

◦ This eBook, offers design patterns and best


practices for building applications on
Kubernetes.

• Kubernetes Cheat Sheet by Red Hat

◦ Website: Red Hat’s Kubernetes Cheat Sheet

◦ This concise cheat sheet covers essential


Kubernetes commands and concepts.

• Kubernetes Podcast

◦ Website: Kubernetes Podcast by Google

◦ Offers insights, news, and discussions on


Kubernetes and its ecosystem.

• Kubernetes Slack Channels and Forums

◦ Slack: Kubernetes Slack Channels

◦ Reddit: Kubernetes Reddit

◦ Join Kubernetes-related Slack channels and


forums to engage with the community, ask
questions, and stay updated on the latest
developments.

JCG delivers over 1 million pages each month to more than 700K software
developers, architects and decision makers. JCG offers something for everyone,
including news, tutorials, cheat sheets, research guides, feature articles, source code
and more.
CHEATSHEET FEEDBACK
WELCOME
support@javacodegeeks.com

Copyright © 2014 Exelixis Media P.C. All rights reserved. No part of this publication may be SPONSORSHIP
reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, OPPORTUNITIES
mechanical, photocopying, or otherwise, without prior written permission of the publisher. sales@javacodegeeks.com

JAVACODEGEEKS.COM | © EXELIXIS MEDIA P.C. VISIT JAVACODEGEEKS.COM FOR MORE!

You might also like