Create Deployments in Kubernetes Cluster
To create the specified deployment named "httpd" to deploy the application httpd using the image httpd:latest, you can use the following YAML configuration:
yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: httpd
spec:
replicas: 1
selector:
matchLabels:
app: httpd
template:
metadata:
labels:
app: httpd
spec:
containers:
- name: httpd
image: httpd:latest
Save the above configuration in a file, e.g., "httpd-deployment.yaml," and then use the kubectl command to create the deployment:
bash
# kubectl create -f httpd-deployment.yaml
To verify that the pod was created successfully, you can run the following command:
# kubectl get pods
Ensure that you have the necessary permissions to create deployments on the Kubernetes cluster. After running the command, the "httpd" deployment will be created, deploying the application using the httpd image with the latest tag. The deployment will have one replica, and it will use the "app=httpd" label to select the pods.
Please make sure that you are using the correct kubectl context to interact with the desired Kubernetes cluster.
No comments:
Post a Comment