• About Us
  • Privacy & Policy
HowTo's
  • Home
  • Commands
  • Linux
  • SCM
  • Git
  • Database
  • MySQL
  • Kubernetes
  • Docker
No Result
View All Result
  • Home
  • Commands
  • Linux
  • SCM
  • Git
  • Database
  • MySQL
  • Kubernetes
  • Docker
No Result
View All Result
HowTo's
No Result
View All Result
Home Kubernetes

Applying Kubernetes Configurations with kubectl apply

June 26, 2024
in Kubernetes, Kubernetes Commands Examples, Kubernetes Commands Tutorial, Kubernetes Tutorial
A A
0
11
SHARES
103
VIEWS
Share on FacebookShare on Twitter

Using kubectl apply allows Kubernetes configurations to be applied or updated based on the YAML or JSON files provided. This command is essential for deploying new resources, updating existing configurations, or even reverting to a previous state if needed.

Here are several examples showcasing the versatility of kubectl apply:

Example 1: Deploying a new Pod from a YAML file:

kubectl apply -f pod.yaml

This command applies the Pod configuration defined in pod.yaml. To verify, use kubectl get pods to see if the Pod is running.

Example 2: Updating a Deployment with a new image:

kubectl apply -f deployment.yaml

If deployment.yaml specifies a new Docker image, this command updates the Deployment accordingly. Check the Deployment status with kubectl get deployment.

Example 3: Applying a Service definition:

kubectl apply -f service.yaml

Creates or updates a Kubernetes Service based on the configuration in service.yaml. Confirm the Service’s creation with kubectl get services.

Example 4: Adding a ConfigMap to the cluster:

kubectl apply -f configmap.yaml

This applies the ConfigMap defined in configmap.yaml. Verify its existence with kubectl get configmap.

Example 5: Applying a PersistentVolumeClaim:

kubectl apply -f pvc.yaml

Creates or updates a PersistentVolumeClaim as defined in pvc.yaml. Check its status using kubectl get pvc.

Example 6: Deploying a CronJob:

kubectl apply -f cronjob.yaml

This command schedules a new CronJob based on the configuration provided in cronjob.yaml. Use kubectl get cronjob to see its execution status.

Example 7: Applying a HorizontalPodAutoscaler:

kubectl apply -f hpa.yaml

Creates or updates a HorizontalPodAutoscaler defined in hpa.yaml. Verify its creation using kubectl get hpa.

Example 8: Deploying a StatefulSet:

kubectl apply -f statefulset.yaml

Applies the StatefulSet configuration from statefulset.yaml. Check its deployment status with kubectl get statefulset.

Example 9: Updating a Namespace:

kubectl apply -f namespace.yaml

If namespace.yaml modifies Namespace attributes, this command updates it. Ensure changes with kubectl get namespace.

Example 10: Applying a Role and RoleBinding:

kubectl apply -f role.yaml -f rolebinding.yaml

Applies both Role and RoleBinding configurations defined in respective files. Verify creation with kubectl get roles and kubectl get rolebindings.

Also check similar articles.

Diffing Kubernetes Configurations with kubectl diff
Listing Kubernetes Events with kubectl events
Troubleshooting Kubernetes with kubectl debug
Managing Kubernetes Authorization with kubectl auth
Copy Files to and from Kubernetes Containers with kubectl cp

Tags: KubernetesKubernetes Commands ExamplesKubernetes Commands TutorialKubernetes Tutorial
Previous Post

Diffing Kubernetes Configurations with kubectl diff

Next Post

Patching Kubernetes Resources with kubectl patch

Related You may like!

howto

Interacting with Kubernetes Plugins using kubectl plugin

June 26, 2024
howto

Configuring kubectl and kubeconfig Files

June 26, 2024

Exploring Kubernetes API Versions with kubectl api-versions

June 26, 2024

Understanding Kubernetes API Resources with kubectl api-resources

June 26, 2024

Generating Shell Completion Code with kubectl completion

June 26, 2024

Managing Kubernetes Annotations with kubectl annotate

June 26, 2024
Next Post
howto

Patching Kubernetes Resources with kubectl patch

howto

Replace Kubernetes Resources with kubectl replace

howto

Waiting for Kubernetes Resources with kubectl wait

Discussion about this post

Latest Updated

howto

How to Use -iname for Case-Insensitive Filename Searches in find

August 21, 2024
howto

Search for Files with Case-Insensitive Pattern Matching Using -ilname in find

August 21, 2024
howto

Find Files by Group Name with -group in find Command

August 21, 2024
howto

Locate Files by Group ID Using -gid in find Command

August 21, 2024
howto

How to Search for Filesystems with -fstype in find Command

August 21, 2024

Trending in Week

  • howto

    Using BTRFS Subvolume for User Home Directory in Linux

    22 shares
    Share 9 Tweet 6
  • Downloading Docker Images from a Registry

    13 shares
    Share 5 Tweet 3
  • Configuring SSL Connection Mode in mysqldump

    17 shares
    Share 7 Tweet 4
  • Omit Tablespace Information in mysqldump Output

    13 shares
    Share 5 Tweet 3
  • Setting MySQL Dump Compatibility Mode

    18 shares
    Share 7 Tweet 5
  • Setting Network Buffer Length in mysqldump

    13 shares
    Share 5 Tweet 3
  • Logging out from Docker Registries

    13 shares
    Share 5 Tweet 3
  • Scheduling Nodes in Kubernetes with kubectl uncordon

    12 shares
    Share 5 Tweet 3
  • Managing Default User Creation Settings in Linux

    15 shares
    Share 6 Tweet 4
  • Using Extended INSERT Syntax in mysqldump

    12 shares
    Share 5 Tweet 3
  • About Us
  • Privacy & Policy

© 2024 All Rights Reserved. Howto.swebtools.com.

No Result
View All Result

© 2024 All Rights Reserved. Howto.swebtools.com.