rifaterdemsahin / openshift-redhat-sandbox

0 stars 0 forks source link

Sandbox SetUp Log #2

Open rifaterdemsahin opened 4 weeks ago

rifaterdemsahin commented 4 weeks ago

tutorial

image

initial objects

image

No Operators

image

Terminal

image

Not Allowed

image
rifaterdemsahin commented 4 weeks ago

terminal

image

not as developer

image
rifaterdemsahin commented 4 weeks ago

terminal on admin pane does not change the fact

image
rifaterdemsahin commented 4 weeks ago

Login information

image

use the existing terminal

image

logged in the terminal so web terminal also works

image
rifaterdemsahin commented 4 weeks ago

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:

1. Check with your OpenShift Administrator

2. Use an Existing Project

3. Use the oc adm Command (if you have admin privileges)

4. Use OpenShift Web Console (if allowed)

5. Review Your Role Bindings

6. Review OpenShift Documentation

If you frequently work on OpenShift, understanding your role and permissions will help you avoid such issues and navigate around them more effectively.

rifaterdemsahin commented 4 weeks ago

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 ~ $

rifaterdemsahin commented 4 weeks ago

one project is there

image
rifaterdemsahin commented 4 weeks ago

To create a basic Nginx application in your OpenShift project rifaterdemsahin-dev, you can follow these steps:

Step 1: Switch to the Desired Project

Ensure you are in the correct project by running:

oc project rifaterdemsahin-dev

Step 2: Deploy the Nginx Application

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

Step 3: Expose the Service

To make your Nginx application accessible externally, you need to create a route:

oc expose svc/nginx-app

Step 4: Verify the Deployment

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.

Step 5: Access the Application

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.

Summary of Commands

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.

rifaterdemsahin commented 4 weeks ago

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 ~ $

rifaterdemsahin commented 4 weeks ago

To create a basic Nginx application in your OpenShift project rifaterdemsahin-dev, you can follow these steps:

Step 1: Switch to the Desired Project

Ensure you are in the correct project by running:

oc project rifaterdemsahin-dev

Step 2: Deploy the Nginx Application

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

Step 3: Expose the Service

To make your Nginx application accessible externally, you need to create a route:

oc expose svc/nginx-app

Step 4: Verify the Deployment

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.

Step 5: Access the Application

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.

Summary of Commands

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.

rifaterdemsahin commented 4 weeks ago

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.

Example Output

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.

rifaterdemsahin commented 4 weeks ago
image

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:

Step 1: Check Pod Status

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.

Step 2: Check Logs

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.

Step 3: Verify the Service

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.

Step 4: Inspect the Route

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).

Step 5: Describe the Resources

You can use the describe command to get more detailed information about the status of your resources:

These commands will provide detailed information that can help identify any issues with the deployment.

Step 6: Restart the Pod (if necessary)

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.

Step 7: Re-check the Route

After performing these steps, re-check the route:

oc get route nginx-app -o jsonpath='{.spec.host}'

Then try accessing the URL again.

Additional Steps (if needed)

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.

rifaterdemsahin commented 4 weeks ago

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 ~ $

rifaterdemsahin commented 4 weeks ago
image

https://console-openshift-console.apps.sandbox-m2.ll9k.p1.openshiftapps.com/k8s/ns/rifaterdemsahin-dev/core~v1~Pod

https://nginx-app-rifaterdemsahin-dev.apps.sandbox-m2.ll9k.p1.openshiftapps.com/

rifaterdemsahin commented 4 weeks ago

image

Mobile uploads

rifaterdemsahin commented 4 weeks ago

image