[RHOCP 4] Unable to expose service via NodePort when using --generator option

Solution Verified - Updated -


When trying to expose a service via a NodePort following the official documentation, the example command fails with the syntax error:

$ oc expose deployment/httpd2 --type=NodePort --name=httpd2 --generator="service/v2"
error: unknown flag: --generator
See 'oc expose --help' for usage.


  • Red Hat OpenShift Container Platform (RHOCP)
    • 4.11 and above

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content