Skip to content

Resources in Kubernates

Resources in Kubernates

  1. Namespace:

Define: Logical Partitions in cluster to group and isolate resources

apiVersion: v1
kind: Namespace
metadata:
  name: production
  labels:
    name: production
kubectl apply -f create-ns.yml

Get NameSpaces

kubectl get namespaces

or

kubectl get ns

To check my current namespace

 kubectl config get-contexts

:::note Check the NAMESPACE column, if it is empty then current namespace is default :::

To change current namespace (current context)

kubectl config set-context --current --namespace={NameSpace}

Pods

Config Maps

Replica Set

Deployment

Every deployment is same as replica set

Any changes in pods configuration in replica set will not take effect in current pods, changes take effect only when new pods are created as part of replica set

But changes in deployment will take effect immediately

Every deployment will create replica set and every change will create new roll out of replica set

To check all changes to deployment

kubectl rollout history deployment deployment-name

To roll back to previous version of the deployment

kubectl rollout undo deployment deployment-name --to-revision=2

To know the revisions

kubectl rollout history deployment deployment-name

Daemonset

To run a copy of pod on all worker nodes

Node Affinity