Devops with OpenShift - openshift

I'm trying to build a new app by using a docker image from the book Devops With OpenShift
so as per the content from the book page 19
the command is
oc new-app devopswithopenshift/welcome:latest --name=myapp
so the devopswithopenshift/welcome:latest needs to be firstly built and pushed to the docker hub.
I pulled the GIT code from https://github.com/devops-with-openshift/welcome
and ran the command C:\Docker\welcome\foo>docker build -t welcome .
Here is the response
failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed
When i looked into the Dockerfile
It has FROM welcome/ops:latest
so it is trying to pull welcome/ops which is not there in the registry can the authors help resolve this
Thanks
K.ThulsiDoss

Thanks for the response .Here is what i did to get going so that users can benefit from the clarifications.
1.My env is windows (client ) and open shift is on RHEL cluster .In my win env i have Git ,OC client installed & docker (win10 ) installed
2.Downloaded the book code into my git dir
3.The important thing is that i logged onto docker with my credentials on the terminal
'''
e.g docker login -- --password on the terminal where i had extracted the code.
'''
4.I then logged onto the OC cluster e.g
'''
oc login --token= --server=https://xyzopenshift.os.fyre.ibm.com:6443

Related

Getting error while deploying code from local Git to Azure via Azure CLI

I am trying to push my code from a protected Git repo via Azure CLI, but I am getting the below error:
az webapp deployment source config --branch *** --manual-integration --name **** --repo-url ***** --resource-group ****
Error
The server name or address could not be resolved
If you want to deploy code from local Git, please make sure you have installed the Git, then follow the steps below.
1.Login and configure a deployment user
az login
az webapp deployment user set --user-name 'joyw1' --password 'Password01!'
2.Get the deployment URL
az webapp deployment source config-local-git -g <group-name> -n <webapp-name>
3.Open a local terminal window to your local Git repository.
4.Add an Azure remote, replace the with the one in step 2.
git remote add azure <url>
Then run the command to push to Azure, it will let you to input the username and password, just input them that you set in the step 1.
git push azure master
For more details, you could refer to this doc - Local Git deployment to Azure App Service.

Using service accounts to automate deployments is failing

We are trying to automate the build and deployment of containers to projects created in openshift v3.3. From the documentation I can see that we will need to leverage service accounts to do this but the documentation is hard to follow and the examples I have found in the blogs don't complete the task. My workflow is as follows with examples oc commands I use:
BUILDER_TOKEN='xxx'
DEPLOYER_TOKEN='xxx'
# build and push the image works as expected
docker build -t registry.xyz.com/want/want:latest .
docker login --username=<someuser> --password=${BUILDER_TOKEN} registry.xyz.com
docker push registry.xyz.com/<repo>/<image>:<tag>
# This fails with error
oc login https://api.xyz.com --token=${DEPLOYER_TOKEN}
oc project <someproject>
oc new-app registry.xyz.com/<repo>/<image>:<tag>
Notice I login into the rest api interface, select the project and create the app but this fails with the following errors:
error: User "system:serviceaccount:want:deployer" cannot create deploymentconfigs in project "default"
error: User "system:serviceaccount:want:deployer" cannot create services in project "default"
Any ideas?
Service accounts only have permission in their owning project by default. You would need to grant deployer access to deploy in other projects.
OK so it seems that using a service account to accomplish this is not the best way to go about things. This is not helped by the documentation. The use case above is very common and the correct approach is to simply evoke the new-app with the image name and corresponding tag:
oc new-app ${APP}:${TAG}
There is no need to mess around with service accounts.

gcloud docker push 403 Forbidden

I am trying to push a docker image to eu.gcr.io and I am getting 403 Forbidden
gcloud docker push eu.gcr.io/<projectname>/<image>:latest
The push refers to a repository [eu.gcr.io/<projectname>/<image>] (len: 1)
663cd9de01fe: Preparing
Post https://eu.gcr.io/v2/w<projectname>/<image>/blobs/uploads/: token auth attempt for registry: https://eu.gcr.io/v2/token?account=_token&scope=repository%3A<projectname>%2F<image>3Apush%2Cpull&service=eu.gcr.io request failed with status: 403 Forbidden
I have checked
curl https://eu.gcr.io/v1/_ping => works
gcloud config list => project id is setup
Storage api is enabled in console
if I use the project name in the url I get 403 Forbidden
if I use the project id in the url I get "Repository does not exist"
gcloud auth list => shows the owner as active
gcloud components update => All components are up to date.
I had faced the same issue, to resolve it in order I done.
Rename the images as told
Add the user to docker group (important for the docker login)
Use docker login token https://cloud.google.com/container-registry/docs/auth
docker login -e 1234#5678.com -u _token -p "$(gcloud auth print-access-token)" https://gcr.io
(If using sudo docker, the token will be stored with the root account.)
Then use docker push gcr.io/projetc_id/imagename according to How to push a docker image to a private repository
Looks like the problem is that the (local) docker tag was incorrect, the tag was the "project name" instead of "gcloud project id" so by changing the tag to contain the project the push works.

How do start using the deployed wirecloud in the lab?

I have just deployed an image of wirecloud on the https://cloud.lab.fiware.org/#nova/images/
I gave it a floating ip and then I connected to it via ssh.
Now what?
I cant find any command to issue in order to start using wirecloud, the entire user guide (https://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Application_Mashup_-Wirecloud-_User_and_Programmer_Guide) is about the UI.
I tried going to the assigned floating ip but all I get is the page (http://150.254.155.20/) from which I cannot log in.
So how do I set up and use the wirecloud once I ssh'ed my way inside the apparently ubuntu machine?
The WireCloud Image available on FIWARE Lab deploys a WireCloud instance at /opt/wirecloud_instance. This instance configures a default admin user (credentials: admin/admin). The first step is to modify this admin user, to do so you have to login inside WireCloud and entering the Django admin panel:
Once in the admin panel, open "Auth -> Users -> admin" and update your admin user:
You can also change the default configuration of this instance (for example, change the default theme, add the emails for error reporting, etc...), please take a look into the Installation and Administration guide for more info.
P.D. Currently the WireCloud image uses WireCloud 0.6.2. You can update it using the following commands:
$ pip install -U wirecloud
$ cd /opt/wirecloud_instance
$ python manage.py syncdb --migrate; python manage.py collectstatic --noinput; python manage.py compress --force

Openshift- git clone gives Permission denied (publickey,gssapi-keyex,gssapi-with-mic)

I have created a new account with openshift online and have created my first app. I have rhc installed on my local machine. I setup ssh keys for the first time using rhc setup -l loginname
i used git clone to clone the remote repo and it worked fine. Then however after changes and tring to do a git push gave me the following error:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
I tried a couple of solutions provided in this forum like using ssh-add etc. but this did not work.I then made sure that all existing ssh keys under .ssh directory and from my openshift online account were deleted and all identities managed by ssh-agent were also deleted. I then launched rhc setup again This created the default ssh keys again and asked me if it could upload the public key which I selected yes to.
However then it gives me the following error:
An SSH connection could not be established to appname-domain-name.rhcloud.com.
Your SSH configuration may not be correct, or the application may not be
responding. connection closed by remote host (Net::SSH::Disconnect)
Kindly help.
I had the same problem while trying to clone from command line...
C:\> git clone GIT_URL DIRECTORY_TO_CREATE
Finally, cloning from the GIT UI solved the problem. Go to menu item All Programs --> GIT --> Git GUI and select "Clone existing repository".