codegurukool.com · Free coding tutorials & online compiler

Home › Kubernetes Tutorial › All commands

All commands

Every command of this course: name, detailed description, syntax and example code.

Every command used in this course, with its name, a detailed description, the syntax and an example.

kubectl

Definition: You talk to it with the kubectl command line tool.

Syntax:

kubectl

Example:

kubectl version --client

↗ Kubernetes introduction

apiVersion

Definition: Every manifest has apiVersion , kind , metadata and spec .

Syntax:

apiVersion

Example:

apiVersion: v1

↗ Pods and YAML manifests

kind

Definition: Every manifest has apiVersion , kind , metadata and spec .

Syntax:

kind

Example:

kind: Pod

↗ Pods and YAML manifests

metadata

Definition: Every manifest has apiVersion , kind , metadata and spec .

Syntax:

metadata

Example:

metadata:

↗ Pods and YAML manifests

spec

Definition: Every manifest has apiVersion , kind , metadata and spec .

Syntax:

spec

Example:

spec:

↗ Pods and YAML manifests

selector

Definition: The selector must match the labels in the Pod template .

Syntax:

selector

Example:

selector:

↗ Deployments

template

Definition: The selector must match the labels in the Pod template .

Syntax:

template

Example:

template:

↗ Deployments

NodePort

Definition: NodePort opens a port (30000-32767) on every node.

Syntax:

NodePort

Example:

kubectl expose deployment web --type=NodePort --port=80

↗ Service types: ClusterIP, NodePort, LoadBalancer

valueFrom

Definition: Use valueFrom to take one value from a ConfigMap ( configMapKeyRef ) or a Secret ( secretKeyRef ) and expose it as an environment variable.

Syntax:

valueFrom

Example:

valueFrom:

↗ Use ConfigMaps and Secrets in a Pod

configMapKeyRef

Definition: Use valueFrom to take one value from a ConfigMap ( configMapKeyRef ) or a Secret ( secretKeyRef ) and expose it as an environment variable.

Syntax:

configMapKeyRef

Example:

configMapKeyRef:

↗ Use ConfigMaps and Secrets in a Pod

secretKeyRef

Definition: Use valueFrom to take one value from a ConfigMap ( configMapKeyRef ) or a Secret ( secretKeyRef ) and expose it as an environment variable.

Syntax:

secretKeyRef

Example:

secretKeyRef:

↗ Use ConfigMaps and Secrets in a Pod

requests

Definition: requests reserve CPU and memory for scheduling, and limits cap what a container may use.

Syntax:

requests

Example:

requests:

↗ Health probes and resource limits

limits

Definition: requests reserve CPU and memory for scheduling, and limits cap what a container may use.

Syntax:

limits

Example:

limits:

↗ Health probes and resource limits

Example code

kubectl version --client

Run this code in the online editor

← Welcome to the Kubernetes courseKubernetes introduction →