Sunday, November 17, 2019

Deploying microservices to Kubernetes using OpenLiberty


OpenLiberty sample github
https://github.com/OpenLiberty/guide-kubernetes-intro

OpenLiberty tutorial
https://openliberty.io/guides/kubernetes-intro.html#what-youll-learn

MiniKubernetes installation guide
https://github.com/kubernetes/minikube#installation

Minikube Linux install
https://minikube.sigs.k8s.io/docs/start/linux/

Fedora Getting started with virtualization
https://docs.fedoraproject.org/en-US/quick-docs/getting-started-with-virtualization/


Dependencies resolved. 
================================================================================================================================================== 
 Package                                      Architecture                Version                               Repository                   Size 
================================================================================================================================================== 
Installing group/module packages: 
 virt-install                                 noarch                      2.2.1-2.fc31                          fedora                       64 k 
 virt-manager                                 noarch                      2.2.1-2.fc31                          fedora                      543 k 
 virt-viewer                                  x86_64                      8.0-3.fc31                            fedora                      404 k 
Installing dependencies: 
 autogen-libopts                              x86_64                      5.18.16-3.fc31                        fedora                       75 k 
 gnutls-dane                                  x86_64                      3.6.10-1.fc31                         fedora                       27 k 
 gnutls-utils                                 x86_64                      3.6.10-1.fc31                         fedora                      341 k 
 libgovirt                                    x86_64                      0.3.4-9.fc30                          fedora                       71 k 
 libvirt-bash-completion                      x86_64                      5.6.0-4.fc31                          fedora                       12 k 
 libvirt-client                               x86_64                      5.6.0-4.fc31                          fedora                      343 k 
 python3-libvirt                              x86_64                      5.6.0-1.fc31                          fedora                      294 k 
 virt-manager-common                          noarch                      2.2.1-2.fc31                          fedora                      1.0 M 
Installing Groups: 
 Virtualization            


dave@localhost finish]$ sudo systemctl start libvirtd
[dave@localhost finish]$ sudo systemctl enable libvirtd
Created symlink /etc/systemd/system/sockets.target.wants/libvirtd.socket → /usr/lib/systemd/system/libvirtd.socket.
Created symlink /etc/systemd/system/sockets.target.wants/libvirtd-ro.socket → /usr/lib/systemd/system/libvirtd-ro.socket.
[dave@localhost finish]$ lsmod | grep kvm
kvm_intel             299008  0
kvm                   770048  1 kvm_intel
irqbypass              16384  1 kvm


Some errors appear in virt validation

[dave@localhost finish]$ virt-host-validate
  QEMU: Checking for hardware virtualization                                 : PASS
  QEMU: Checking if device /dev/kvm exists                                   : PASS
  QEMU: Checking if device /dev/kvm is accessible                            : PASS
  QEMU: Checking if device /dev/vhost-net exists                             : PASS
  QEMU: Checking if device /dev/net/tun exists                               : PASS
  QEMU: Checking for cgroup 'cpu' controller support                         : WARN (Enable 'cpu' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS
  QEMU: Checking for cgroup 'cpuset' controller support                      : WARN (Enable 'cpuset' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for cgroup 'memory' controller support                      : PASS
  QEMU: Checking for cgroup 'devices' controller support                     : WARN (Enable 'devices' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for cgroup 'blkio' controller support                       : WARN (Enable 'blkio' in kernel Kconfig file or mount/enable cgroup controller in your system)
  QEMU: Checking for device assignment IOMMU support                         : PASS
  QEMU: Checking if IOMMU is enabled by kernel                               : WARN (IOMMU appears to be disabled in kernel. Add intel_iommu=on to kernel cmdline arguments)
   LXC: Checking for Linux >= 2.6.26                                         : PASS
   LXC: Checking for namespace ipc                                           : PASS
   LXC: Checking for namespace mnt                                           : PASS
   LXC: Checking for namespace pid                                           : PASS
   LXC: Checking for namespace uts                                           : PASS
   LXC: Checking for namespace net                                           : PASS
   LXC: Checking for namespace user                                          : PASS
   LXC: Checking for cgroup 'cpu' controller support                         : FAIL (Enable 'cpu' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking for cgroup 'cpuacct' controller support                     : PASS
   LXC: Checking for cgroup 'cpuset' controller support                      : FAIL (Enable 'cpuset' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking for cgroup 'memory' controller support                      : PASS
   LXC: Checking for cgroup 'devices' controller support                     : FAIL (Enable 'devices' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking for cgroup 'freezer' controller support                     : FAIL (Enable 'freezer' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking for cgroup 'blkio' controller support                       : FAIL (Enable 'blkio' in kernel Kconfig file or mount/enable cgroup controller in your system)
   LXC: Checking if device /sys/fs/fuse/connections exists                   : PASS


[root@localhost ~]# sudo dnf config-manager --add-repo=https://download.docker.com/linux/fedora/docker-ce.repo

Adding repo from: https://download.docker.com/linux/fedora/docker-ce.repo

 


After Docker installtion all tests pass

[root@localhost ~]# virt-host-validate

  QEMU: Checking for hardware virtualization                                 : PASS

  QEMU: Checking if device /dev/kvm exists                                   : PASS

  QEMU: Checking if device /dev/kvm is accessible                            : PASS

  QEMU: Checking if device /dev/vhost-net exists                             : PASS

  QEMU: Checking if device /dev/net/tun exists                               : PASS

  QEMU: Checking for cgroup 'cpu' controller support                         : PASS

  QEMU: Checking for cgroup 'cpuacct' controller support                     : PASS

  QEMU: Checking for cgroup 'cpuset' controller support                      : PASS

  QEMU: Checking for cgroup 'memory' controller support                      : PASS

  QEMU: Checking for cgroup 'devices' controller support                     : PASS

  QEMU: Checking for cgroup 'blkio' controller support                       : PASS

  QEMU: Checking for device assignment IOMMU support                         : PASS

  QEMU: Checking if IOMMU is enabled by kernel                               : WARN (IOMMU appears to be disabled in kernel. Add intel_iommu=on to kernel cmdline arguments)

   LXC: Checking for Linux >= 2.6.26                                         : PASS

   LXC: Checking for namespace ipc                                           : PASS

   LXC: Checking for namespace mnt                                           : PASS

   LXC: Checking for namespace pid                                           : PASS

   LXC: Checking for namespace uts                                           : PASS

   LXC: Checking for namespace net                                           : PASS

   LXC: Checking for namespace user                                          : PASS

   LXC: Checking for cgroup 'cpu' controller support                         : PASS

   LXC: Checking for cgroup 'cpuacct' controller support                     : PASS

   LXC: Checking for cgroup 'cpuset' controller support                      : PASS

   LXC: Checking for cgroup 'memory' controller support                      : PASS

   LXC: Checking for cgroup 'devices' controller support                     : PASS

   LXC: Checking for cgroup 'freezer' controller support                     : PASS

   LXC: Checking for cgroup 'blkio' controller support                       : PASS

   LXC: Checking if device /sys/fs/fuse/connections exists                   : PASS

 


Install minikube
https://minikube.sigs.k8s.io/docs/start/linux/



 
Download and install minikube to /usr/local/bin:

 
 curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 \

   && sudo install minikube-linux-amd64 /usr/local/bin/minikube

 
 


Start minukube

[dave@localhost ~]$ minikube start --vm-driver=kvm2

😄  minikube v1.5.2 on Fedora 31

✨  Automatically selected the 'kvm2' driver (alternates: [none])

💾  Downloading driver docker-machine-driver-kvm2:

    > docker-machine-driver-kvm2.sha256: 65 B / 65 B [-------] 100.00% ? p/s 0s

    > docker-machine-driver-kvm2: 13.87 MiB / 13.87 MiB  100.00% 8.94 MiB p/s 2

💿  Downloading VM boot image ...

    > minikube-v1.5.1.iso.sha256: 65 B / 65 B [--------------] 100.00% ? p/s 0s

    > minikube-v1.5.1.iso: 143.76 MiB / 143.76 MiB [-] 100.00% 17.68 MiB p/s 9s

🔥  Creating kvm2 VM (CPUs=2, Memory=2000MB, Disk=20000MB) ...

 

dave@localhost ~]$ minikube start

😄  minikube v1.5.2 on Fedora 31

💡  Tip: Use 'minikube start -p <name>' to create a new cluster, or 'minikube delete' to delete this one.

🏃  Using the running kvm2 "minikube" VM ...

⌛  Waiting for the host to be provisioned ...

🐳  Preparing Kubernetes v1.16.2 on Docker '18.09.9' ...

💾  Downloading kubeadm v1.16.2

💾  Downloading kubelet v1.16.2

🔄  Relaunching Kubernetes using kubeadm ... 

 

Need to work on virtual host configuration

🔄  Relaunching Kubernetes using kubeadm ... 

  
💣  Error restarting cluster: waiting for apiserver: apiserver process never appeared

 


Need to download and install Fedora 31 image

Create storage

dd if=/dev/zero of=/var/lib/libvirt/images/guest.img bs=1M count=20480


Download ISO image at https://getfedora.org/en/workstation/download/

 root@localhost ~]# cp /home/dave/Downloads/Fedora-Workstation-Live-x86_64-31-1.9.iso /var/lib/libvirt/images/Fedora-Workstation-31/
 root@localhost ~]# virt-install --name Fedora31 --description 'Fedora 31 Workstation' --ram 4096 --vcpus 2 --disk path=/var/lib/libvirt/images/Fedora-Workstation-31/Fedora-Workstation-31-20180518.0.x86_64.qcow2,size=20 --os-type linux --os-variant fedora31 --network bridge=virbr0 --graphics vnc,listen=127.0.0.1,port=5901 --cdrom /var/lib/libvirt/images/Fedora-Workstation-31/Fedora-Workstation-Live-x86_64-31-1.9.iso --noautoconsole

Install Kubernetes client
[root@localhost ~]# dnf install kubernetes-client

 


dave@localhost ~]$  kubectl get po -A

NAMESPACE     NAME                               READY   STATUS    RESTARTS   AGE

kube-system   coredns-5644d7b6d9-hgfrq           1/1     Running   0          3m27s

kube-system   coredns-5644d7b6d9-rh2wp           1/1     Running   0          3m27s

kube-system   etcd-minikube                      1/1     Running   0          2m24s

kube-system   kube-addon-manager-minikube        1/1     Running   0          3m37s

kube-system   kube-apiserver-minikube            1/1     Running   0          2m16s

kube-system   kube-controller-manager-minikube   1/1     Running   0          2m24s

kube-system   kube-proxy-brljs                   1/1     Running   0          3m26s

kube-system   kube-scheduler-minikube            1/1     Running   0          2m18s

kube-system   storage-provisioner                1/1     Running   0          3m25s

 

[dave@localhost guide-kubernetes-intro]$ ls

finish  LICENSE  README.adoc  scripts  start

[dave@localhost guide-kubernetes-intro]$ cd finish/

[dave@localhost finish]$ kubectl get nodes

NAME       STATUS   ROLES    AGE     VERSION

minikube   Ready    master   5m24s   v1.16.2

 


Follow the OpenLiberty guide

 https://openliberty.io/guides/kubernetes-intro.html#building-and-containerizing-the-microservices


https://openliberty.io/guides/kubernetes-intro.html#building-and-containerizing-the-microservices

[INFO] Reactor Summary for guide-kubernetes-intro 1.0-SNAPSHOT:

[INFO] 

[INFO] guide-kubernetes-intro ............................. SUCCESS [  0.114 s]

[INFO] system ............................................. SUCCESS [ 56.164 s]

[INFO] inventory .......................................... SUCCESS [  3.497 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  01:01 min

[INFO] Finished at: 2019-11-23T14:51:32+01:00

[INFO] ------------------------------------------------------------------------

 



Build Docker images

[dave@localhost finish]$ docker build -t system:1.0-SNAPSHOT system/.

Sending build context to Docker daemon  173.1MB

Step 1/2 : FROM open-liberty

latest: Pulling from library/open-liberty

7ddbc47eeb70: Pull complete 

c1bbdc448b72: Pull complete 

8c3b70e39044: Pull complete 

45d437916d57: Pull complete 

da4c04c54fa4: Pull complete 

8f6c6858a836: Pull complete 

5d00a703c295: Pull complete 

cb8753aefdab: Pull complete 

973c4edce328: Pull complete 

768f5576235d: Pull complete 

03125c94a5ec: Pull complete 

Digest: sha256:c23b036bed7bd0dec141db5bbde186fb617fd67f4d2db4c1a7793eb483354fc9

Status: Downloaded newer image for open-liberty:latest

 ---> 33db8778e38a

Step 2/2 : ADD --chown=1001:0 target/system.tar.gz /opt/ol

 ---> 63fb2879e723

Successfully built 63fb2879e723

Successfully tagged system:1.0-SNAPSHOT

 


Build inventory image
[dave@localhost finish]$ docker build -t inventory:1.0-SNAPSHOT inventory/.

Sending build context to Docker daemon    174MB

Step 1/2 : FROM open-liberty

 ---> 33db8778e38a

Step 2/2 : ADD --chown=1001:0 target/inventory.tar.gz /opt/ol

 ---> c2f7faff812d

Successfully built c2f7faff812d

Successfully tagged inventory:1.0-SNAPSHOT

 


List of Docker images

[dave@localhost finish]$ docker images

REPOSITORY                                TAG                 IMAGE ID            CREATED              SIZE

inventory                                 1.0-SNAPSHOT        c2f7faff812d        44 seconds ago       393MB

system                                    1.0-SNAPSHOT        63fb2879e723        About a minute ago   393MB

open-liberty                              latest              33db8778e38a        2 weeks ago          392MB

k8s.gcr.io/kube-proxy                     v1.16.2             8454cbe08dc9        5 weeks ago          86.1MB

k8s.gcr.io/kube-controller-manager        v1.16.2             6e4bffa46d70        5 weeks ago          163MB

k8s.gcr.io/kube-apiserver                 v1.16.2             c2c9a0406787        5 weeks ago          217MB

k8s.gcr.io/kube-scheduler                 v1.16.2             ebac1ae204a2        5 weeks ago          87.3MB

k8s.gcr.io/etcd                           3.3.15-0            b2756210eeab        2 months ago         247MB

k8s.gcr.io/coredns                        1.6.2               bf261d157914        3 months ago         44.1MB

k8s.gcr.io/kube-addon-manager             v9.0.2              bd12a212f9dc        4 months ago         83.1MB

k8s.gcr.io/kube-addon-manager             v9.0                119701e77cbc        10 months ago        83.1MB

k8s.gcr.io/kubernetes-dashboard-amd64     v1.10.1             f9aed6605b81        11 months ago        122MB

k8s.gcr.io/k8s-dns-sidecar-amd64          1.14.13             4b2e93f0133d        14 months ago        42.9MB

k8s.gcr.io/k8s-dns-kube-dns-amd64         1.14.13             55a3c5209c5e        14 months ago        51.2MB

k8s.gcr.io/k8s-dns-dnsmasq-nanny-amd64    1.14.13             6dc8ef8287d3        14 months ago        41.4MB

k8s.gcr.io/pause                          3.1                 da86e6ba6ca1        23 months ago        742kB

gcr.io/k8s-minikube/storage-provisioner   v1.8.1              4689081edb10        2 years ago          80.8MB

 


kubernetes.yaml
apiVersion: apps/v1

kind: Deployment

metadata:

  name: system-deployment

  labels:

    app: system

spec:

  selector:

    matchLabels:

      app: system

  template:

    metadata:

      labels:

        app: system

    spec:

      containers:

      - name: system-container

        image: system:1.0-SNAPSHOT

        ports:

        - containerPort: 9080

---

apiVersion: apps/v1

kind: Deployment

metadata:

  name: inventory-deployment

  labels:

    app: inventory

spec:

  selector:

    matchLabels:

      app: inventory

  template:

    metadata:

      labels:

        app: inventory

    spec:

      containers:

      - name: inventory-container

        image: inventory:1.0-SNAPSHOT

        ports:

        - containerPort: 9080

---

apiVersion: v1

kind: Service

metadata:

  name: system-service

spec:

  type: NodePort

  selector:

    app: system

  ports:

  - protocol: TCP

    port: 9080

    targetPort: 9080

    nodePort: 31000

---

apiVersion: v1

kind: Service

metadata:

  name: inventory-service

spec:

  type: NodePort

  selector:

    app: inventory

  ports:

  - protocol: TCP

    port: 9080

    targetPort: 9080

    nodePort: 32000


[dave@localhost finish]$ kubectl apply -f kubernetes.yaml

deployment.apps/system-deployment created

deployment.apps/inventory-deployment created

service/system-service created

service/inventory-service created

 



get pods

[dave@localhost finish]$ kubectl get pods

NAME                                    READY   STATUS    RESTARTS   AGE

inventory-deployment-759769c979-tzq9b   1/1     Running   0          24s

system-deployment-94895d89d-6dpp6       1/1     Running   0          24s

[dave@localhost finish]$ 

 


Describe pods
[dave@localhost finish]$ kubectl describe pods

Name:           inventory-deployment-759769c979-tzq9b

Namespace:      default

Priority:       0

Node:           minikube/192.168.39.189

Start Time:     Sat, 23 Nov 2019 14:55:44 +0100

Labels:         app=inventory

                pod-template-hash=759769c979

Annotations:    <none>

Status:         Running

IP:             172.17.0.5

Controlled By:  ReplicaSet/inventory-deployment-759769c979

Containers:

  inventory-container:

    Container ID:   docker://255c6a483511976cc861a644e3c83049411c9dfb9deb39694ed2f456f821a0bf

    Image:          inventory:1.0-SNAPSHOT

    Image ID:       docker://sha256:c2f7faff812d29712919e170acb72ce64192ba9fee543ce1b56a3f3271c59ae1

    Port:           9080/TCP

    Host Port:      0/TCP

    State:          Running

      Started:      Sat, 23 Nov 2019 14:55:45 +0100

    Ready:          True

    Restart Count:  0

    Environment:    <none>

    Mounts:

      /var/run/secrets/kubernetes.io/serviceaccount from default-token-z9cp2 (ro)

Conditions:

  Type              Status

  Initialized       True 

  Ready             True 

  ContainersReady   True 

  PodScheduled      True 

Volumes:

  default-token-z9cp2:

    Type:        Secret (a volume populated by a Secret)

    SecretName:  default-token-z9cp2

    Optional:    false

QoS Class:       BestEffort

Node-Selectors:  <none>

Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s

                 node.kubernetes.io/unreachable:NoExecute for 300s

Events:

  Type    Reason     Age        From               Message

  ----    ------     ----       ----               -------

  Normal  Scheduled  <unknown>  default-scheduler  Successfully assigned default/inventory-deployment-759769c979-tzq9b to minikube

  Normal  Pulled     49s        kubelet, minikube  Container image "inventory:1.0-SNAPSHOT" already present on machine

  Normal  Created    49s        kubelet, minikube  Created container inventory-container

  Normal  Started    48s        kubelet, minikube  Started container inventory-container

 
 
Name:           system-deployment-94895d89d-6dpp6

Namespace:      default

Priority:       0

Node:           minikube/192.168.39.189

Start Time:     Sat, 23 Nov 2019 14:55:44 +0100

Labels:         app=system

                pod-template-hash=94895d89d

Annotations:    <none>

Status:         Running

IP:             172.17.0.4

Controlled By:  ReplicaSet/system-deployment-94895d89d

Containers:

  system-container:

    Container ID:   docker://eaaaa4976cd8ec0218872276faacf9bd52dcfac125ab2a1ce372ab692d88b859

    Image:          system:1.0-SNAPSHOT

    Image ID:       docker://sha256:63fb2879e723f56f74af3ec4ad6f4672ba3dbe8db3b162a5cb80b7496703f1c2

    Port:           9080/TCP

    Host Port:      0/TCP

    State:          Running

      Started:      Sat, 23 Nov 2019 14:55:45 +0100

    Ready:          True

    Restart Count:  0

    Environment:    <none>

    Mounts:

      /var/run/secrets/kubernetes.io/serviceaccount from default-token-z9cp2 (ro)

Conditions:

  Type              Status

  Initialized       True 

  Ready             True 

  ContainersReady   True 

  PodScheduled      True 

Volumes:

  default-token-z9cp2:

    Type:        Secret (a volume populated by a Secret)

    SecretName:  default-token-z9cp2

    Optional:    false

QoS Class:       BestEffort

Node-Selectors:  <none>

Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s

                 node.kubernetes.io/unreachable:NoExecute for 300s

Events:

  Type    Reason     Age        From               Message

  ----    ------     ----       ----               -------

  Normal  Scheduled  <unknown>  default-scheduler  Successfully assigned default/system-deployment-94895d89d-6dpp6 to minikube

  Normal  Pulled     49s        kubelet, minikube  Container image "system:1.0-SNAPSHOT" already present on machine

  Normal  Created    49s        kubelet, minikube  Created container system-container

  Normal  Started    48s        kubelet, minikube  Started container system-container

 


Get ip
[dave@localhost finish]$ minikube ip 

192.168.39.189

 



Test  endpoint
[dave@localhost finish]$ curl http://192.168.39.189:31000/system/properties

{"java.vendor":"Eclipse OpenJ9","default.https.port":"9443","sun.java.launcher":"SUN_STANDARD","shared.resource.dir":"/opt/ol/wlp/usr/shared/resources/","os.name":"Linux","kernel.launch.time":"809693252842","sun.boot.class.path":"/opt/java/openjdk/lib/amd64/compressedrefs/jclSC180/vm.jar:/opt/java/openjdk/lib/se-service.jar:/opt/java/openjdk/lib/rt.jar:/opt/java/openjdk/lib/resources.jar:/opt/java/openjdk/lib/jsse.jar:/opt/java/openjdk/lib/charsets.jar:/opt/java/openjdk/lib/jce.jar","default.http.port":"9080","java.vm.specification.vendor":"Oracle Corporation","shared.app.dir":"/opt/ol/wlp/usr/shared/apps/","java.runtime.version":"1.8.0_232-b09","wlp.lib.dir":"/opt/ol/wlp/lib/","wlp.workarea.dir":"workarea/","user.name":"default","java.compiler":"j9jit29","os.encoding":"UTF-8","com.ibm.util.extralibs.properties":"","com.ibm.jcl.checkClassPath":"","server.tmp.dir":"/opt/ol/wlp/output/defaultServer/workarea/tmp/","user.language":"en","jdk.attach.allowAttachSelf":"true","com.ibm.oti.vm.bootstrap.library.path":"/opt/java/openjdk/lib/amd64/compressedrefs:/opt/java/openjdk/lib/amd64","sun.boot.library.path":"/opt/java/openjdk/lib/amd64/compressedrefs:/opt/java/openjdk/lib/amd64","wlp.install.dir":"/opt/ol/wlp/","server.output.dir":"/opt/ol/wlp/output/defaultServer/","jdk.extensions.version":"8.0.232.0","java.util.logging.manager":"com.ibm.ws.kernel.boot.logging.WsLogManager","java.version":"1.8.0_232","user.timezone":"GMT","com.ibm.system.agent.path":"/opt/java/openjdk/lib/amd64","sun.arch.data.model":"64","com.ibm.zero.version":"2","java.endorsed.dirs":"/opt/java/openjdk/lib/endorsed","com.ibm.oti.vm.library.version":"29","sun.jnu.encoding":"UTF-8","file.encoding.pkg":"sun.io","file.separator":"/","java.specification.name":"Java Platform API Specification","java.class.version":"52.0","user.country":"US","java.home":"/opt/java/openjdk","java.vm.info":"JRE 1.8.0 Linux amd64-64-Bit Compressed References 20191017_442 (JIT enabled, AOT enabled)\nOpenJ9   - 77c1cf708\nOMR      - 20db4fbc\nJCL      - 97b5ec8f383 based on jdk8u232-b09","os.version":"4.19.76","java.awt.fonts":"","path.separator":":","org.apache.aries.blueprint.preemptiveShutdown":"false","java.vm.version":"openj9-0.17.0","user.variant":"","wlp.user.dir.isDefault":"true","ibm.cds.suppresserrors":"true","java.awt.printerjob":"sun.print.PSPrinterJob","jdk.extensions.name":"Extensions for OpenJDK for Eclipse OpenJ9","sun.io.unicode.encoding":"UnicodeLittle","awt.toolkit":"sun.awt.X11.XToolkit","ibm.signalhandling.sigint":"true","org.apache.cxf.stax.allowInsecureParser":"1","user.home":"/home/default","com.ibm.cpu.endian":"little","java.specification.vendor":"Oracle Corporation","ibm.signalhandling.sigchain":"true","org.jboss.weld.xml.disableValidating":"true","java.library.path":"/opt/java/openjdk/lib/amd64/compressedrefs:/opt/java/openjdk/lib/amd64:/usr/lib64:/usr/lib","java.vendor.url":"http://www.eclipse.org/openj9","java.vm.vendor":"Eclipse OpenJ9","java.fullversion":"1.8.0_232-b09\nJRE 1.8.0 Linux amd64-64-Bit Compressed References 20191017_442 (JIT enabled, AOT enabled)\nOpenJ9   - 77c1cf708\nOMR      - 20db4fbc\nJCL      - 97b5ec8f383 based on jdk8u232-b09","java.runtime.name":"OpenJDK Runtime Environment","sun.net.http.retryPost":"false","sun.java.command":"/opt/ol/wlp/bin/tools/ws-server.jar defaultServer","java.class.path":"/opt/ol/wlp/bin/tools/ws-server.jar:/opt/ol/wlp/bin/tools/ws-javaagent.jar:/opt/ol/wlp/bin/tools/ws-javaagent.jar","server.config.dir":"/opt/ol/wlp/usr/servers/defaultServer/","wlp.user.dir":"/opt/ol/wlp/usr/","java.vm.specification.name":"Java Virtual Machine Specification","sun.java.launcher.pid":"1","java.vm.specification.version":"1.8","sun.cpu.endian":"little","java.awt.headless":"true","java.io.tmpdir":"/tmp","ibm.system.encoding":"UTF-8","shared.config.dir":"/opt/ol/wlp/usr/shared/config/","os.arch":"amd64","java.awt.graphicsenv":"sun.awt.X11GraphicsEnvironment","ibm.signalhandling.rs":"false","java.ext.dirs":"/opt/java/openjdk/lib/ext","user.dir":"/opt/ol/wlp/output/defaultServer","line.separator":"\n","java.vm.name":"Eclipse OpenJ9 VM","com.ibm.oti.shared.enabled":"true","com.ibm.vm.bitmode":"64","wlp.process.type":"server","javax.management.builder.initial":"com.ibm.ws.kernel.boot.jmx.internal.PlatformMBeanServerBuilder","file.encoding":"UTF-8","java.specification.version":"1.8","com.ibm.oti.configuration":"scar","wlp.server.name":"defaultServer"}


Scale deployment
[dave@localhost finish]$ kubectl scale deployment/system-deployment --replicas=3

deployment.apps/system-deployment scaled

[dave@localhost finish]$ kubectl get pods

NAME                                    READY   STATUS    RESTARTS   AGE

inventory-deployment-759769c979-tzq9b   1/1     Running   0          11m

system-deployment-94895d89d-58mlq       1/1     Running   0          5s

system-deployment-94895d89d-6dpp6       1/1     Running   0          11m

system-deployment-94895d89d-9q9xz       1/1     Running   0          5s

 


Run tests

[INFO] -------------------------------------------------------

[INFO]  T E S T S

[INFO] -------------------------------------------------------

[INFO] Running it.io.openliberty.guides.inventory.InventoryEndpointTest

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.188 s - in it.io.openliberty.guides.inventory.InventoryEndpointTest

[INFO] 

[INFO] Results:

[INFO] 

[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

[INFO] 

[INFO] 

[INFO] --- liberty-maven-plugin:3.0.M1:test-stop-server (test-stop-server) @ inventory ---

[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-runtime:null:RELEASE:zip.

[INFO] CWWKM2102I: Using installDirectory : /git/guide-kubernetes-intro/finish/inventory/target/liberty/wlp.

[INFO] CWWKM2102I: Using serverName : defaultServer.

[INFO] CWWKM2102I: Using serverDirectory : /git/guide-kubernetes-intro/finish/inventory/target/liberty/wlp/usr/servers/defaultServer.

[INFO] CWWKM2152I: Stopping server defaultServer.

[INFO] CWWKM2001I: server.config.dir is /git/guide-kubernetes-intro/finish/inventory/target/liberty/wlp/usr/servers/defaultServer.

[INFO] CWWKM2001I: server.output.dir is /git/guide-kubernetes-intro/finish/inventory/target/liberty/wlp/usr/servers/defaultServer.

[INFO] CWWKM2001I: Invoke command is [/git/guide-kubernetes-intro/finish/inventory/target/liberty/wlp/bin/server, stop, defaultServer].

[INFO] 

[INFO] Stopping server defaultServer.

[INFO] Server defaultServer stopped.

[INFO] 

[INFO] --- maven-failsafe-plugin:3.0.0-M1:verify (verify-results) @ inventory ---

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary for guide-kubernetes-intro 1.0-SNAPSHOT:

[INFO] 

[INFO] guide-kubernetes-intro ............................. SUCCESS [  0.003 s]

[INFO] system ............................................. SUCCESS [  8.917 s]

[INFO] inventory .......................................... SUCCESS [  9.144 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD SUCCESS

 


Resource usage


Virtual machine manager

[root@localhost ~]# virt-manager