Sunday, 16 February 2025

Learn Docker Kubernates and create volumes.

    1 kubectl apply -f pv.yaml

   2 kubectl apply -f pvc.yaml

   3 kubectl apply -f n_deploy.yaml

   4 kubectl delete pod -l app=spellrich-nginx

   5 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

   6 Get-ChildItem -Path C:\Users\h\Documents\spellrich

   7 kubectl get pv html-pv

   8 kubectl get pvc html-pvc

   9 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  10 kubectl apply -f pv.yaml

  11 kubectl delete pv html-pv

  12 kubectl apply -f pv.yaml

  13 kubectl apply -f pvc.yaml

  14 kubectl get pv html-pv

  15 kubectl get pvc html-pvc

  16 kubectl delete pod -l app=spellrich-nginx

  17 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  18 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  19 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  20 kubectl delete pv html-pv

  21 kubectl apply -f pv.yaml

  22 kubectl delete pod -l app=spellrich-nginx

  23 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  24 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  25 kubectl delete pod -l app=spellrich-nginx

  26 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  27 docker run --rm -v C:\spellrich:/test busybox ls -lah /test

  28 kubectl delete pvc html-pvc

  29 kubectl delete pv html-pv

  30 kubectl apply -f pv.yaml

  31 kubectl apply -f pvc.yaml

  32 kubectl delete pvc html-pvc

  33 kubectl delete pv html-pv

  34 kubectl apply -f pv.yaml

  35 kubectl apply -f pvc.yaml

  36 kubectl delete pod -l app=spellrich-nginx

  37 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  38 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  39 kubectl get pods -l app=spellrich-nginx -o wide

  40 kubectl describe pod -l app=spellrich-nginx

  41 kubectl delete pvc html-pvc

  42 kubectl delete pod -l app=spellrich-nginx

  43 kubectl apply -f pv.yaml

  44 kubectl apply -f pvc.yaml

  45 kubectl get pvc html-pvc

  46 kubectl delete deployment spellrich-nginx

  47 kubectl apply -f n_deploy.yaml

  48 kubectl get pods -l app=spellrich-nginx -o wide

  49 kubectl get pods -l app=spellrich-nginx -o wide

  50 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  51 kubectl describe pod -l app=spellrich-nginx

  52 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  53 kubectl exec -it spellrich-nginx -- ls -lah /usr/share/nginx/html

  54 kubectl get pods -l app=spellrich-nginx

  55 kubectl exec -it spellrich-nginx-66cfcf96f-8dlb8 -- ls -lah /usr/share/nginx/html

  56 echo "<h1>Hello from spellrich!</h1>" > C:\spellrich\index.html

  57 kubectl delete pod -l app=spellrich-nginx

  58 kubectl apply -f n_deploy.yaml

  59 kubectl apply -f n_deploy.yaml

  60 kubectl exec -it $(kubectl get pods -l app=spellrich-nginx -o jsonpath='{.items[0].metadata.name}') --...

  61 kubectl apply -f n_deploy.yaml

  62 kubectl apply -f pv.yaml

  63 kubectl apply -f pvc.yaml

  64 kubectl delete pod -l app=spellrich-nginx

  65 kubectl get pods

  66 kubectl describe pod spellrich-nginx-66cfcf96f-gbb47

  67 kubectl exec -it spellrich-nginx-66cfcf96f-gbb47 -- /bin/sh

  68 kubectl get pv

  69 kubectl describe pv pvc-3910a7f7-8efb-4220-b83a-c26458a54ee9

  70 kubectl patch storageclass hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-de...

  71 kubectl patch storageclass hostpath -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-de...

  72 kubectl patch storageclass hostpath --type=merge `...

  73 kubectl patch storageclass hostpath --type=merge `...

  74 kubectl edit storageclass hostpath

  75 kubectl get storageclass

  76 kubectl edit storageclass hostpath

  77 kubectl apply -f pv.yaml

  78 kubectl apply -f pvc.yaml

  79 kubectl apply -f pvc.yaml

  80 kubectl delete pvc html-pvc

  81 kubectl apply -f pvc.yaml

  82 kubectl delete pvc html-pvc

  83 kubectl get pods -l app=spellrich-nginx

  84 kubectl delete pod -l app=spellrich-nginx

  85 kubectl exec -it spellrich-nginx-66cfcf96f-gbb47 -- /bin/sh

  86 kubectl get pods

  87 kubectl get pods

  88 kubectl get nodes

  89 kubectl apply -f pvc.yaml

  90 kubectl apply -f pv.yaml

  91 kubectl apply -f n_deploy.yaml

  92 kubectl apply -f n_deploy.yaml

  93 kubectl delete pod -l app=spellrich-nginx

  94 kubectl get pods

  95 kubectl get pods

  96 kubectl apply -f n_deploy.yaml

  97 kubectl delete pod -l app=spellrich-nginx

  98 kubectl get pods

  99 kubectl apply -f deployment.yaml

 100 kubectl apply -f n_deploy.yaml

 101 kubectl get pods

 102 kubectl apply -f n_deploy.yaml

 103 kubectl get pods

 104 kubectl apply -f n_deploy.yaml

 105 kubectl delete pod -l app=spellrich-nginx

 106 kubectl get pods

Monday, 19 March 2012

How to run java on android? Step by step solution

What is the problem?
  1. How to install Java application on Android?
  2. Run Java Application on Android?
  3. Is Android support Java?
  4. Run Midlet J2ME on Java?
  5. J2ME emulator for Android?
  6. Is it possible to run Java on Android? (*yes it's possible)

This is a some of the simple question that haunted me for several weeks, but if you Google it, you will get outdated and you feel that most of the solution is not working. So please back link this or share this article if you think that's this solution help solve your problems.


Some of not working or incomplete solution



The first bet, you will find JBED Java emulator that will run on Android so that you can run Java Games and Midlet. The problems with JBED is that it's have not been updated to support android version 2.0 and above.

The installation is troublesome,  you need to modify some Android root to make it works.

Open the archive and move 'system/lib/libjbedvm.so' to /system/lib/libjbedvm.so to your device (with ADB or etc) then move 'system/app/Jbed.apk' to /system/app/Jbed.apk'

Most people got confuse with this type of instruction and finally give up.


I also give up after several failed attempt to install JBED on my Samsung Galaxy Tab 7.0 inch.

Secondly, i tried to netmite solution that claims can convert the Convert j2me MIDP (jad) into Android package (apk) automatically from the Web Interface. Well, i strongly feel that this web interface just don't works. It's just 0.001 probability that's it will automatically convert your java code into APK. I tried several times with a few Java JAR and JAD files to the netmite.com but i'ts always failed.

This netmite converter is not working. Give up after several tried.


Then, i started to think that, there is no way, that JAVA midlet can automatically run on Android. After searching for Midlet for JAVA, JAVA, or JAR in the Android market, i feel that it's never ever get supported by the Google Android.


How to run java application on Android?


Luckily, I found the true solution that gonna help you run Java application on Android. It's also work on Android 2.2 and above.

I m gonna show you step by step on how to run java , midlet , jar or jad files from your Android to prove the idea of running Java Application on Android without source code recompilation So, the first step is to Install Java emulator on  Virtual Box and download Android ISO to be specific. (You required at least Android version 2.2 to support JAVA. So download this version.
http://android-x86.googlecode.com/files/android-x86-2.2-generic.iso

Tips: From my testing, Android .

Why Android emulator on Virtual PC? Because, it's let you test and tried several Android version from your desktop PC. You also can install Android APK files to test your java application. It's also a good solution if you don't own real Android phone. :-)

Create New Virtual Machine Wizard, before boot, attach Android iso.


Note that there are two options available to run android without installation.
1. HDPI is for High Definition.
2. MDPI is for Medium Definition.
3 VESA Mode

(Here ‘H’ is used for ‘High’ & ‘M’ is used for ‘Medium’, And ‘DPI’ means ‘Dots Per Inch’ – a measure of screen pixel density)

*Make sure you choose Install Android x-86 to hardisk. Because we need to create fake SD- Card later on.

Step 1: Install Android on VirtualBox and Create Fake SD Card


Create new partion, set bootable and write then quit.


Choose Ext3 filesystem to format sda1:


Create Fake SD Card (sdcard.img 2GB). You probably can choose lower size to speed up installation.


Click and Drag Green Padlock to unlock.