-
Bug
-
Resolution: Done
-
Minor
-
None
-
4.12, 4.11
-
None
-
Quality / Stability / Reliability
-
False
-
-
2
-
None
-
No
-
None
-
None
-
OSDOCS Sprint 234
-
1
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Description of problem:
In the Chapter Exposing the service by creating a route the Step 3.
oc expose service nodejs-ex --type=NodePort --name=nodejs-ex-nodeport --generator="service/v2"
cannot be done with the --generator option if the oc client version is 4.12:
$ oc get clusterversions.config.openshift.io NAME VERSION AVAILABLE PROGRESSING SINCE STATUS version 4.12.2 True False 2d Cluster version is 4.12.2 $ oc get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE nodejs-ex ClusterIP 172.30.225.50 <none> 8080/TCP 78s $ oc expose service nodejs-ex --type=NodePort --name=nodejs-ex-nodeport --generator="service/v2" error: unknown flag: --generator See 'oc expose --help' for usage.
Managing a cluster of a certain version should be done with the same version of the oc client. So, for an OCP version 4.12 you could not use the --generator option of the $ oc expose command.
Our recommendation is to change the steps to configure NodePort Service resource to expose a service in Exposing the service by creating a route . There are two possible options to configure NodePort Service resource to expose a service (cf. RHOCP 4 Unable to expose service via NodePort..) :
- By editing the service definition to specify spec.type:NodePort and optionally specify a port in the 30000-32767 range:
$ oc get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE httpd ClusterIP 172.xx.xx.xx <none> 8080/TCP,8443/TCP 41s $ oc edit svc httpd spec: ... ports: - name: 8080-tcp nodePort: 30546 port: 8080 protocol: TCP targetPort: 8080 - name: 8443-tcp nodePort: 30327 port: 8443 protocol: TCP targetPort: 8443 sessionAffinity: None type: NodePort $ oc get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE httpd NodePort 172.xx.xx.xx <none> 8080:30546/TCP,8443:30327/TCP 109s
- By exposing the deployment:
$ oc get deploy NAME READY UP-TO-DATE AVAILABLE AGE httpd 1/1 1 1 6s $ oc expose deployment/httpd --type=NodePort --name=httpd service/httpd exposed $ oc get svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE httpd NodePort 172.xx.xx.xx <none> 8080:30287/TCP,8443:30163/TCP 5s
Version-Release number of selected component (if applicable):
4.12
- is related to
-
OCPBUGS-11433 Get an error when introducing command oc command with deprecated option
-
- Closed
-
- relates to
-
OCPBUGS-11433 Get an error when introducing command oc command with deprecated option
-
- Closed
-