How to debug kubernetes deployed service using Eclipse - eclipse

I have a micro service written using Java EE + Openliberty. I have deployed this into kubernetes in my Docker-Desktop. I want to know, is there any way to debug this deployed service? I am using Eclipse. Please let me know how can I debug deployed service. Thank you!

I heartily endorse looking at telepresence. I don't use it for real yet, but I've verified it will be very useful in our enterprise once we get some pieces in place.
However, I don't believe you need that complication for your simpler situation. Telepresence will be very nice for injecting NEW code into a cluster without actually deploying it. In your case, you just want to debug the existing code. This allows for a simpler mechanism.
To remotely debug in Eclipse, you need to connect to a debugger port. To do this with code running in a k8s cluster, you have to expose the port to connect to, and make it available on your desktop.
In your image, you have to ensure that your Java command line has the "-Xdebug" parameters, which specifies the debugger port (5005 by convention). You also have to ensure that your Dockerfile specifies that port to be exposed. When that is running in your cluster, you have to use "kubectl port-forward" on your desktop (with appropriate parameters). This will proxy the debugger port in the cluster to a corresponding port on your desktop. You then connect to that port from Eclipse.

If you want to debug your application, you can do it using either squash or telepresence. Here is great article comparing these two solutions
Article also mentions that squash doesn't support eclipse, but notice that is was written in 2018 and since then squash added support for eclipse IDE.

Related

Can new Rancher version be used for local cluster only?

I have been working with kubernetes in a staging environment for a couple of month and want to switch to production, I came across a tool called Rancher almost 2 weeks ago and since then am going through their documents.
It was recommended by the developers and also in the community not to use rancher in production kubernete and preferably create a separated cluster for that and add an agent to your main production cluster from that one.
However in the latest stable version, there is actually an option you can tick to use the rancher only for local cluster so this question came to my mind that:
If the latest stable version of rancher is modified to be deployed on production cluster itself rather than having dedicated cluster? and if there is any security or restarting issues can happen that deletes all the configurations for other components on cluster
Note: on another staging environment I installed on the local clustor an instance of wordpress and ghost and both were working fine.
I still think the best option for you would be to have fully accessible own cluster and you wont be dependent to rancher cloud solutions. I am not saying Rancher is bad - no. Just If you are talking about PRODUCTION environment - my personal opinion cluster should be own. Sure arguable topic.
What I can mention also here - you can use any of Useful Interactive Terminal and Graphical UI Tools for Kubernetes . for example Octant
Octant is a browser-based UI aimed at application developers giving
them visibility into how their application is running. I also think
this tool can really benefit anyone using K8s, especially if you
forget the various options to kubectl to inspect your K8s Cluster
and/or workloads. Octant is also a VMware Open Source project and it
is supported on Windows, Mac and Linux (including ARM) and runs
locally on a system that has access to a K8S Cluster. After installing
Octant, just type octant and it will start listening on localhost:7777
and you just launch your web browser to access the UI.

Material on Building a REST api from within a docker container

I'm looking to build an api on a application that is going to run its own docker container. It needs to work with some applications via its REST apis. I'm new to development and dont understand the process very well. Can you share the broad steps necessary to build and release the APIs so that my application runs safely within the docker but externally whatever communication needs to happen they work out well.
For context: I'm going to be working on a Google Compute VM instance and the application I'm building is a HyperLedger Fabric program written in GoLang.
Links to reference material and code would also be appreciated.
REST API implementation is very easy in Go. You can use the inbuilt net/http package. Here's a tutorial which will help you understand its usage. https://tutorialedge.net/golang/creating-restful-api-with-golang/
Note : If you are planning on developing a production server, the default HTTP client is not recommended. It will knock down the server on heavy frequency calls. In that case, you have to use a custom HTTP client as described here, https://medium.com/#nate510/don-t-use-go-s-default-http-client-4804cb19f779
For learning docker I would recommend the docker docs they're very good and cover a handful of stuff. Docker swarm and orchestration are useful things to learn but most people aren't using docker swarm anymore and use things like kubernetes instead. Same principles, but different tech. I would definitely go through this website: https://docs.docker.com/ and implemented on your own computer. Then just practice by looking at other peoples dockerfiles and building your own. A good understanding a linux will definitely help with installing packages and so on.
I haven't used go myself but I suspect it shouldn't be too hard to deploy into a docker container.
The last production step of deployment will be similar for whatever your using if it's docker or no docker. The VM will need an webserver like apache or nginx to expose the ports you wish to use to the public and then you will run the docker container or the go server independently and then you'll have your system!
Hope this helps!

How can I install oVirt on one server?

I have one server.
And when I install ovirt I can open web interface at 10.0.0.10.
But, then I try instal host on 10.0.0.10 after that I can`t open 10.0.0.10
So, how I can instal ovirt-engine and host on one server?
Can you give me link to any tutorials?
If you're going to use a single host for both engine and run vms, the supported and suggested configuration is to use Hosted Engine.
See http://www.ovirt.org/documentation/how-to/hosted-engine/
You should follow the official quickstart guide http://www.ovirt.org/documentation/quickstart/quickstart-guide/
This definitely works for oVirt release 3.6 and Fedora 22 Server.
After you add the host in the webgui, it deploys necessary packages and configurations on the host. One of these steps configures and starts iptables. Maybe you first need to disable iptables and reconfigure it and that's the reason why your ovirt-engine isn't available after your deployment is finished. You can read the details which ports to open for iptables in the Quickstart Guide.
If you use CentOS this post maybe also helpful http://blog.mit.bme.hu/meszaros/en/node/193
oVirt Orb is what you are looking for, if you just want to try it out. "oVirt Orb lets you try out oVirt on your own laptop. You can test it and play with it, all without the need to manually install all the components or use multiple hosts or a storage server."
If you have shared storage available somewhere or don't mind setting it up, Hosted Engine (as Sandro mentioned) will give you an Engine Virtual Machine running on a single Host. (Hosted Engine requires NFS, iSCSI, etc.)

How to setup and configure service fabric clusters?

I am reading the docs about service fabric and was also interested to review how to setup a cluster with multiple VM's, but so far I can only guess based on the devclustersetup.ps1 / it's xml file, but I didn't see any docs on it which explains the various configurations and/or API's.
What I would need is how to set up a simple cluster, how to add/remove nodes, monitoring, setting up resource constraints per node etc so I can setup a sample cluster and test few things.
So far I've done these:
installed VC runtime ( as web pi installer fails without it )
installed service fabric and the SDK ( got the installer out of the web pi installers )
tried to change the sample xml, adding multiple hosts, but then with that I ran into the IPv6 only issue in my setup ( see my other question ), so it didnt work out
Thanks
We are working on NanoServer support for Service Fabric. (I am unable to respond to the comment asking about it because I apparently don't have enough points).
Setting up a multi-machine cluster is not supported at this time so you won't find any documentation explaining how to do it.
There will be a public preview of the service in Azure later this year and the platform will be available as part of Windows Server 2016 for on-premise deployments. As those options become available, there will be plenty of guidance explaining how to setup and manage your cluster.
UPDATE: 2016-03-31
Standalone installation on-prem or in another cloud is now available in public preview for Windows Server 2012 R2 and up.

Heroku-like services for Scala?

I love Heroku but I would prefer to develop in Scala rather than Ruby on Rails.
Does anyone know of any services like Heroku that work with Scala?
UPDATE: Heroku now officially supports Scala - see answers below for links
As of October 3rd 2011, Heroku officially supports Scala, Akka and sbt.
http://blog.heroku.com/archives/2011/10/3/scala/
Update
Heroku has just announced support for Java.
Update 2
Heroku has just announced support for Scala
Also
Check out Amazon Elastic Beanstalk.
To deploy Java applications using
Elastic Beanstalk, you simply:
Create your application as you
normally would using any editor or IDE
(e.g. Eclipse).
Package your
deployable code into a standard Java
Web Application Archive (WAR file).
Upload your WAR file to Elastic
Beanstalk using the AWS Management
Console, the AWS Toolkit for Eclipse,
the web service APIs, or the Command
Line Tools.
Deploy your application.
Behind the scenes, Elastic Beanstalk
handles the provisioning of a load
balancer and the deployment of your
WAR file to one or more EC2 instances
running the Apache Tomcat application
server.
Within a few minutes you will
be able to access your application at
a customized URL (e.g.
http://myapp.elasticbeanstalk.com/).
Once an application is running,
Elastic Beanstalk provides several
management features such as:
Easily deploy new application versions
to running environments (or rollback
to a previous version).
Access
built-in CloudWatch monitoring metrics
such as average CPU utilization,
request count, and average latency.
Receive e-mail notifications through
Amazon Simple Notification Service
when application health changes or
application servers are added or
removed.
Access Tomcat server log
files without needing to login to the
application servers.
Quickly restart
the application servers on all EC2
instances with a single command.
Another strong contender is Cloud Foundry. One of the nice features of Cloud Foundry is the ability to have a local version of "the cloud" running on your laptop so you can deploy and test offline.
I started working on the exact same thing as what you said a few weeks ago. I use Lift, which is a great framework and has a lot of potential, on top of Linux chroot environment.
I'm done with a demo version, but Linux chroot is not that stable (nor secure), so I'm now switching to FreeBSD jail on Amazon EC2, and hopefully it'll be done soon.
http://lifthub.net/
There are also other Java hosting environment including VMForce mentioned above.
If you are looking for a custom setup which also has the ease of deployment that heroku offers: http://dotcloud.com. They are invite only right now but I was given access in under three days. I am working on a Lift/MongoDB project there and it works well.
Off the top of my head, only VMForce comes to mind, but its not available yet. This will be a Java-oriented service, so that probably means you'll have to spend a wee bit of time figuring out how to package the app.
For more discussion, there was a debate about this in 2008.
I'm not entirely sure if it's really suitable or not, but people have deployed Scala applications to Google App Engine, for example http://mawson.wordpress.com/2009/04/10/first-steps-with-scala-on-google-app-engine/
Actually you can run scala on heroku right now. You don't believe it?
https://github.com/lstoll/heroku-playframework-scala
I'm not sure the tricks lstoll has used are legit but using the
new cedar platform where you can run custom processes and some
ingenious Gemfile hacking he has managed to bootstrap the Java
play platform into a process. Seems to work as he has a live
site running a test page.
Stax cloud service offers preconfigured lift project skeleton. Also, there is a tutorial on how to deploy lift project to appengine.