Skip to content

Creating Your First Deployment on a Kubernetes Cluster

Netcloud24
Cloud Infrastructure Expert
HOSTING H1

Free web hosting H1

5 GB of storage and SSL for a small website or WordPress project.

Explore hosting H1
WINDOWS VPS + RDS

Run Windows applications remotely

Windows Server 2022 or 2025 and RDS CALs included in the plan. Choose resources and user capacity for your business.

Explore Windows VPS
NetCloud24 Expert Guides Open the dedicated video page

Video transcript: NetCloud24 Expert Guides. Practical knowledge for a reliable cloud. Cloud and VPS expertise, security, performance, and step-by-step tutorials. Learn, deploy, and keep building with NetCloud24.

 

 

Introduction

Kubernetes is an open-source platform designed to automate deploying, scaling, and operating application containers. In this guide, you will learn how to create your first deployment on a Kubernetes cluster. This setup can be effectively hosted on a for optimal performance.

Prerequisites

  • A Kubernetes cluster up and running (can be a local cluster like Minikube or a cloud-based cluster)
  • kubectl installed on your local machine
  • Basic knowledge of Linux commands and YAML syntax

Step 1: Verify Kubernetes Cluster

Check if your Kubernetes cluster is running by executing:

kubectl cluster-info

You should see information about the Kubernetes master and the DNS services.

Step 2: Create a Deployment Configuration File

Create a YAML file for your deployment configuration. You can name it deployment.yaml:

Visual overview of Creating Your First Deployment on a Kubernetes Cluster
Visual overview: Creating Your First Deployment on a Kubernetes Cluster
nano deployment.yaml

Add the following content to define a simple Nginx deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

Step 3: Apply the Deployment

Use the following command to create the deployment on your Kubernetes cluster:

kubectl apply -f deployment.yaml

This command will create the deployment as specified in your YAML file.

Step 4: Verify the Deployment

Check the status of your deployment with:

kubectl get deployments

You should see your nginx-deployment listed with the desired number of replicas.

Step 5: Expose the Deployment

Expose your deployment to make it accessible from outside the cluster:

Key topics covered in Creating Your First Deployment on a Kubernetes Cluster
Key topics covered in this NetCloud24 guide.
kubectl expose deployment nginx-deployment --type=NodePort --port=80

Step 6: Access Your Application

To access your Nginx application, you need to find out the NodePort assigned:

kubectl get services

Note the port number and access your application at http://:.

Step 7: Conclusion

You have successfully created your first deployment on a Kubernetes cluster. This foundational knowledge allows you to efficiently manage applications in a containerized environment. Hosting your Kubernetes cluster on a can enhance performance and reliability. For additional options, explore various solutions, including Windows VPSVirtual Private Server Hosting and Windows VPS Hosting UK.

© 2024 Kubernetes Deployment Tutorial. All rights reserved.

Creating Your First Deployment on a Kubernetes Cluster
Creating Your First Deployment on a Kubernetes Cluster
Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.

Creating Your First Deployment on a Kubernetes Cluster

Netcloud24
Cloud Infrastructure Expert
HOSTING H1

Free web hosting H1

5 GB of storage and SSL for a small website or WordPress project.

Explore hosting H1
WINDOWS VPS + RDS

Run Windows applications remotely

Windows Server 2022 or 2025 and RDS CALs included in the plan. Choose resources and user capacity for your business.

Explore Windows VPS
NetCloud24 Expert Guides Open the dedicated video page

Video transcript: NetCloud24 Expert Guides. Practical knowledge for a reliable cloud. Cloud and VPS expertise, security, performance, and step-by-step tutorials. Learn, deploy, and keep building with NetCloud24.

 

 

Introduction

Kubernetes is an open-source platform designed to automate deploying, scaling, and operating application containers. In this guide, you will learn how to create your first deployment on a Kubernetes cluster. This setup can be effectively hosted on a for optimal performance.

Prerequisites

  • A Kubernetes cluster up and running (can be a local cluster like Minikube or a cloud-based cluster)
  • kubectl installed on your local machine
  • Basic knowledge of Linux commands and YAML syntax

Step 1: Verify Kubernetes Cluster

Check if your Kubernetes cluster is running by executing:

kubectl cluster-info

You should see information about the Kubernetes master and the DNS services.

Step 2: Create a Deployment Configuration File

Create a YAML file for your deployment configuration. You can name it deployment.yaml:

Visual overview of Creating Your First Deployment on a Kubernetes Cluster
Visual overview: Creating Your First Deployment on a Kubernetes Cluster
nano deployment.yaml

Add the following content to define a simple Nginx deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: nginx:latest
        ports:
        - containerPort: 80

Step 3: Apply the Deployment

Use the following command to create the deployment on your Kubernetes cluster:

kubectl apply -f deployment.yaml

This command will create the deployment as specified in your YAML file.

Step 4: Verify the Deployment

Check the status of your deployment with:

kubectl get deployments

You should see your nginx-deployment listed with the desired number of replicas.

Step 5: Expose the Deployment

Expose your deployment to make it accessible from outside the cluster:

Key topics covered in Creating Your First Deployment on a Kubernetes Cluster
Key topics covered in this NetCloud24 guide.
kubectl expose deployment nginx-deployment --type=NodePort --port=80

Step 6: Access Your Application

To access your Nginx application, you need to find out the NodePort assigned:

kubectl get services

Note the port number and access your application at http://:.

Step 7: Conclusion

You have successfully created your first deployment on a Kubernetes cluster. This foundational knowledge allows you to efficiently manage applications in a containerized environment. Hosting your Kubernetes cluster on a can enhance performance and reliability. For additional options, explore various solutions, including Windows VPSVirtual Private Server Hosting and Windows VPS Hosting UK.

© 2024 Kubernetes Deployment Tutorial. All rights reserved.

Creating Your First Deployment on a Kubernetes Cluster
Creating Your First Deployment on a Kubernetes Cluster
Explore more

More on this topic

Netcloud24
Netcloud24
Cloud Infrastructure Expert · NetCloud24

Comments are closed.