Nginx – Replication Controller Not Found

google-cloud-platformkubernetesnginx

I'm new to Google Cloud Platform and Kubernetes. I've been following this tutorial and stuck with the following command:

kubectl expose rc my-nginx --target-port=80 --type=NodePort

When in try to expose the RC it would print:

Error from server (NotFound): replicationcontrollers "my-nginx" not found

Am I missing something here?

Best Answer

You can use the following commands to create nginx pod and expose it as a service, as mentioned in this article:

Create nginx pod:

kubectl run nginx --image=nginx --port=80

Expose nginx as a service:

kubectl expose deployment nginx --target-port=80 --type=NodePort
Related Topic