Open rifaterdemsahin opened 4 weeks ago
terminal
not as developer
terminal on admin pane does not change the fact
Login information
use the existing terminal
logged in the terminal so web terminal also works
The error message Error from server (Forbidden): You may not request a new project via this API.
indicates that your current user permissions do not allow you to create new projects in the OpenShift cluster. This restriction is often set by the OpenShift administrators to control resource allocation and project management within the cluster.
Here are some steps you can take to address this issue:
oc project <projectname>
to switch to a project where you have the necessary permissions.oc adm
Command (if you have admin privileges)oc adm
command to create a new project. However, this typically requires cluster-admin level access. oc adm new-project myargo --admin=your-username
your-username
with your actual OpenShift username. oc get rolebindings --all-namespaces | grep your-username
If you frequently work on OpenShift, understanding your role and permissions will help you avoid such issues and navigate around them more effectively.
Error from server (Forbidden): You may not request a new project via this API. bash-5.1 ~ $ oc adm new-project myargo --admin=rifaterdemsahin Error from server (Forbidden): projects.project.openshift.io "myargo" is forbidden: User "rifaterdemsahin" cannot get resource "projects" in API group "project.openshift.io" in the namespace "myargo" bash-5.1 ~ $
bash-5.1 ~ $ oc get rolebindings --all-namespaces | grep rifaterdemsahin Error from server (Forbidden): rolebindings.rbac.authorization.k8s.io is forbidden: User "rifaterdemsahin" cannot list resource "rolebindings" in API group "rbac.authorization.k8s.io" at the cluster scope bash-5.1 ~ $
one project is there
To create a basic Nginx application in your OpenShift project rifaterdemsahin-dev
, you can follow these steps:
Ensure you are in the correct project by running:
oc project rifaterdemsahin-dev
You can create a new Nginx application using OpenShift’s oc new-app
command. This command will automatically create a deployment, service, and route for your application.
oc new-app nginx --name=nginx-app
To make your Nginx application accessible externally, you need to create a route:
oc expose svc/nginx-app
You can check the status of your Nginx application deployment with:
oc get pods
Ensure that your pod is running and the status shows Running
.
To get the URL of your deployed Nginx application, use the following command:
oc get route nginx-app
This will output the route URL, which you can open in your browser to see the Nginx welcome page.
Here’s a quick summary of the commands you’ll run:
oc project rifaterdemsahin-dev
oc new-app nginx --name=nginx-app
oc expose svc/nginx-app
oc get pods
oc get route nginx-app
This will deploy a basic Nginx server in your OpenShift project, expose it via a route, and provide you with a URL to access it.
bash-5.1 ~ $ oc get rolebindings --all-namespaces | grep rifaterdemsahin Error from server (Forbidden): rolebindings.rbac.authorization.k8s.io is forbidden: User "rifaterdemsahin" cannot list resource "rolebindings" in API group "rbac.authorization.k8s.io" at the cluster scope bash-5.1 ~ $ oc project rifaterdemsahin-dev Already on project "rifaterdemsahin-dev" on server "https://api.sandbox-m2.ll9k.p1.openshiftapps.com:6443". bash-5.1 ~ $
bash-5.1 ~ $ oc get rolebindings --all-namespaces | grep rifaterdemsahin Error from server (Forbidden): rolebindings.rbac.authorization.k8s.io is forbidden: User "rifaterdemsahin" cannot list resource "rolebindings" in API group "rbac.authorization.k8s.io" at the cluster scope bash-5.1 ~ $ oc project rifaterdemsahin-dev Already on project "rifaterdemsahin-dev" on server "https://api.sandbox-m2.ll9k.p1.openshiftapps.com:6443". bash-5.1 ~ $ oc new-app nginx --name=nginx-app --> Found image 2c92ed8 (7 weeks old) in image stream "openshift/nginx" under tag "1.22-ubi8" for "nginx"
Nginx 1.22
----------
Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high concurrency, performance and low memory usage. The container image provides a containerized packaging of the nginx 1.22 daemon. The image can be used as a base image for other applications based on nginx 1.22 web server. Nginx server image can be extended using source-to-image tool.
Tags: builder, nginx, nginx-122
--> Creating resources ... deployment.apps "nginx-app" created service "nginx-app" created --> Success Application is not exposed. You can expose services to the outside world by executing one or more of the commands below: 'oc expose service/nginx-app' Run 'oc status' to view your app. bash-5.1 ~ $
bash-5.1 ~ $ oc expose svc/nginx-app route/nginx-app exposed bash-5.1 ~ $ bash-5.1 ~ $ oc get pods NAME READY STATUS RESTARTS AGE nginx-app-7bb59c79d-qg6zl 0/1 Completed 2 (29s ago) 36s workspace8b40c8b9b3db4efc-845b854bd-s6r8w 2/2 Running 0 11m bash-5.1 ~ $ oc get route nginx-app NAME HOST/PORT PATH SERVICES PORT TERMINATION WILDCARD nginx-app nginx-app-rifaterdemsahin-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com nginx-app 8080-tcp None bash-5.1 ~ $
To create a basic Nginx application in your OpenShift project rifaterdemsahin-dev
, you can follow these steps:
Ensure you are in the correct project by running:
oc project rifaterdemsahin-dev
You can create a new Nginx application using OpenShift’s oc new-app
command. This command will automatically create a deployment, service, and route for your application.
oc new-app nginx --name=nginx-app
To make your Nginx application accessible externally, you need to create a route:
oc expose svc/nginx-app
You can check the status of your Nginx application deployment with:
oc get pods
Ensure that your pod is running and the status shows Running
.
To get the URL of your deployed Nginx application, use the following command:
oc get route nginx-app
This will output the route URL, which you can open in your browser to see the Nginx welcome page.
Here’s a quick summary of the commands you’ll run:
oc project rifaterdemsahin-dev
oc new-app nginx --name=nginx-app
oc expose svc/nginx-app
oc get pods
oc get route nginx-app
This will deploy a basic Nginx server in your OpenShift project, expose it via a route, and provide you with a URL to access it.
To get the HTTP route and access URL for your Nginx application, you can run the following command:
oc get route nginx-app -o jsonpath='{.spec.host}'
This command retrieves the hostname of the route, which is the URL you can use to access your Nginx application.
Let's say the output of the command is:
nginx-app-rifaterdemsahin-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com
You can now access your Nginx application by navigating to:
http://nginx-app-rifaterdemsahin-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com
Open this URL in your web browser, and you should see the default Nginx welcome page.
The error message indicates that the Nginx application is not currently available at the specified route. This could be due to a few reasons, such as the application pods not being up and running, a misconfiguration in the route, or a service issue. Here's how you can troubleshoot and resolve the issue:
First, check if the Nginx pod is running:
oc get pods
Look for the pod associated with your Nginx application (it should have a name like nginx-app-xxx
). Ensure the pod status is Running
. If it is not running, you might need to check the logs to diagnose why.
If the pod is not running or is in a crash loop, check the logs for more information:
oc logs <pod-name>
Replace <pod-name>
with the actual name of the Nginx pod.
Ensure the service for your Nginx application is correctly set up and running:
oc get svc
The service should have the same name as your application (e.g., nginx-app
). Verify that the service has a valid cluster IP and that the ports are correctly exposed.
Check that the route is correctly configured and points to the right service:
oc get route nginx-app -o yaml
Look for the spec.to.name
field and ensure it matches the service name (nginx-app
).
You can use the describe
command to get more detailed information about the status of your resources:
oc describe pod <pod-name>
oc describe svc nginx-app
oc describe route nginx-app
These commands will provide detailed information that can help identify any issues with the deployment.
If you suspect that the pod may have failed to start correctly, you can delete the pod to force a new one to be created:
oc delete pod <pod-name>
The deployment will automatically create a new pod, which might resolve any startup issues.
After performing these steps, re-check the route:
oc get route nginx-app -o jsonpath='{.spec.host}'
Then try accessing the URL again.
If the problem persists, it could be related to:
By following these troubleshooting steps, you should be able to identify and resolve the issue preventing your Nginx application from being accessible.
bash-5.1 ~ $ oc get route nginx-app -o jsonpath='{.spec.host}' bash-5.1 ~ $ oc get podsn-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.combash-5.1 ~ $ oc get pods NAME READY STATUS RESTARTS AGE nginx-app-7bb59c79d-qg6zl 0/1 CrashLoopBackOff 7 (14s ago) 11m workspace8b40c8b9b3db4efc-845b854bd-s6r8w 2/2 Running 0 22m bash-5.1 ~ $
oc logs nginx-app-7bb59c79d-qg6zl
ash-5.1 ~ $ oc logs nginx-app-7bb59c79d-qg6zl This is a S2I rhel base image.
To use it in OpenShift, run:
oc new-app nginx:1.22~https://github.com/sclorg/nginx-container.git --context-dir=1.22/test/test-app/
You can then run the resulting image via:
docker run -p 8080:8080 nginx-sample-app
Alternatively, to run the image directly using podman or docker, or how to use it as a parent image in a Dockerfile, see documentation at
https://github.com/sclorg/nginx-container/blob/master/1.22/README.md. bash-5.1 ~ $
Mobile uploads
tutorial
initial objects
No Operators
Terminal
Not Allowed