Page cover

How to Create a New Deployment use CLI

To create a Deployment through the CLI by running the following syntax.

nano deployment.yaml

The deployment.yaml file page appears automatically and includes the following lines of code. You can customize the name, and namespaces.

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

To apply the configuration to pod.yaml , you need to run the following syntax.

kubectl apply -f deployment.yaml

Last updated