Assistanz
Assistanz

Steps to run a POD in a Selected Node in the Kubernetes

Steps to run a POD in a Selected Node in the Kubernetes

In this blog, we will show you the steps to run a POD in a Selected Node in the kubernetes environment.

REQUIREMENTS

  • 2 Node Cluster ( 1 Master VM with 2 Nodes)
  • Kubernetes Components

 

INFRASTRUCTURE OVERVIEW

  • We have already installed and configured the 2 Node cluster in our demo environment.

 

ADDING LABEL TO A NODE USING KUBECTL

  • Log in to the master server through putty.

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Use show labels option to view the node’s labels.

kubectl get nodes --show-labels

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Use the label command to set a label for a node.

Syntax: kubectl label <object type> <object name> <label values>

Example: kubectl lable node k8s-node2 type=hdd

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Command executed successfully.

Steps to run a POD in a Selected Node in the Kubernetes

 

  • We can verify the label information using show labels option.

Steps to run a POD in a Selected Node in the Kubernetes

 

CREATING A POD IN THE SELECTED NODE

  • Create a new file and paste the below coding.

Steps to run a POD in a Selected Node in the Kubernetes

apiVersion: v1
kind: Pod
metadata:
   name: node-pod
   labels:
      app: web
      env: test
spec:
   nodeSelector:
      type: "hdd"
   containers:
      - name: node-cont
        image: nginx

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Save and close the file.

 

  • Create a new POD using the YAML file.

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Command executed successfully.

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Verify the pod status using wide option. We can see our new POD is assigned to node2 using the node labels.

Steps to run a POD in a Selected Node in the Kubernetes

 

DELETE A LABEL FROM THE NODE

  • Use the below command to delete a label from a node.

Syntax: kubectl label <object type> <object name> <label value>-

Example: kubectl label node k8s-node2 type-

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Command executed successfully.

Steps to run a POD in a Selected Node in the Kubernetes

 

  • Verify the changes.

Steps to run a POD in a Selected Node in the Kubernetes

VIDEO

Thanks for reading this blog. We hope it was useful for you to run a POD in a selected node in the kubernetes environment.

Most Popular:

Get The Latest Updates

Subscribe To Our Weekly Newsletter

No spam, notifications only about new products, updates.

DirectAdmin Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk
$ 99 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • NDA & SLA
  • SLA Review Meetings
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation
  •  

Platinum Support

24/7 Proactive Support
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Support

$ 30 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response Time
  • 4 Hours Resolution time for the Possible Issues
  • Security and Performance Optimization
  • React to Customers queries
  • Simple SignUp Process
  • Instant Account Activation
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support

Cpanel Server Management Plans

Premium Support

24/7 End User Support from your Helpdesk

$ 99 Monthly / Server
  • 24/7 End User White Label Support
  • Unlimited Number of Tickets
  • Chat Support for Admin
  • Separate Account Manager
  • Guaranteed SLA
  • Weekly Status Reports
  • FREE Consultancy Services
  • Simple SignUp Process
  • Instant Account Activation

Platinum Support

24/7 Proactive Server Management
$ 49 Monthly / Server
  • Unlimited Support Plan
  • 24/7 Emergency Phone
  • Chat Support for Admin
  • Separate Account Manager
  • Advance Proactive Monitoring
  • Guaranteed SLA
  • SLA Review Meetings
  • 3rd Party Application Support
  • FREE Consultancy Services
  • Server Migration Support
  • Weekly Status Report
  • No End User Support
Popular

Unlimited Support

24/7 Server Management

$ 29 Monthly / Server
  • Unlimited Admin Tasks
  • 24/7 Support
  • Basic Monitoring
  • 30 Minutes Response time
  • 4 hours Response time for possible issues
  • Security and Performance Optimization
  • React to Customers queries
  • No Third party application support
  • No Migration and End User Support