0

When I use the kubectl run command instead of creating a deployment it creates a pod/selenium-node-chrome and as a result, I am unable to scale the selenium-node-chrome using the replicas command.

PS C:\Users\Test> kubectl run selenium-node-chrome --image selenium/node-chrome:latest --env="HUB_PORT_4444_TCP_ADDR=selenium-hub" --env="HUB_PORT_4444_TCP_PORT=4444"
pod/selenium-node-chrome created
PS C:\Users\Test> kubectl scale deployment selenium-node-chrome --replicas=5
Error from server (NotFound): deployments.extensions "selenium-node-chrome" not found

The video tutorial that I followed successfully created deployment "selenium-node-chrome" after running the same command. Please I need help and I am new to Kubernetes. Thanks.

melleck
  • 306
  • 4
  • 15

2 Answers2

1

You should use a generator

kubectl run selenium-node-chrome \
  --image selenium/node-chrome:latest \
  --env="HUB_PORT_4444_TCP_ADDR=selenium-hub" \
  --env="HUB_PORT_4444_TCP_PORT=4444" \
  --generator=deployment/apps.v1beta1

https://v1-17.docs.kubernetes.io/docs/reference/kubectl/conventions/#generators

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
  • Still pod gets created PS C:\Users\Test> kubectl run selenium-node-chrome --image selenium/node-chrome:latest --env="HUB_PORT_4444_TCP_ADDR=s elenium-hub" --env="HUB_PORT_4444_TCP_PORT=4444" --generator=deployment/apps.v1beta1 Flag --generator has been deprecated, has no effect and will be removed in the future. pod/selenium-node-chrome created – melleck Apr 22 '20 at 12:30
  • thats not true. a deployment gets created `deployment.apps/selenium-node-chrome created` obviously a pod gets created by the deployment as well – 4c74356b41 Apr 22 '20 at 12:41
  • no deployments PS C:\Users\Test> kubectl run selenium-node-chrome --image selenium/node-chrome:latest --env="HUB_PORT_4444_TCP_ADDR=selenium-hub" --env="HUB_PORT_4444_TCP_PORT=4444" --generator=deployment/apps.v1beta1 Flag --generator has been deprecated, has no effect and will be removed in the future. pod/selenium-node-chrome created PS C:\Users\Test> kubectl get deployments No resources found in default namespace. PS C:\Users\Test> kubectl scale deployment selenium-node-chorme --replicas=5 Error from server (NotFound): deployments.extensions "selenium-node-chorme" not found – melleck Apr 22 '20 at 12:48
0

All generators are deprecated in Kubernetes version 1.18. From the docs here

Note: All kubectl generators are deprecated. See the Kubernetes v1.17 documentation for a list of generators and how they were used.

You can use kubectl create deployment my-dep --image=busybox to create a deployment.

Also to create a yaml file use kubectl create deployment my-dep --image=busybox --dry-run=client -o yaml > deployment.yaml and then edit the yaml file to add env or any other details and apply the yaml via kubectl apply -f deployment.yaml

Arghya Sadhu
  • 41,002
  • 9
  • 78
  • 107
  • but I can't pass on the --env="HUB_PORT_4444_TCP_ADDR=selenium-hub" --env="HUB_PORT_4444_TCP_PORT=4444" using create deployment is there any possible workaround so that I can pass --env env – melleck Apr 22 '20 at 12:46
  • just create a yaml file and use `kubectl apply`? – 4c74356b41 Apr 22 '20 at 12:52