K8s Applications mit MicroK8S auf Raspberry PI. Alfred Sabitzer
Чтение книги онлайн.

Читать онлайн книгу K8s Applications mit MicroK8S auf Raspberry PI - Alfred Sabitzer страница 24

Название: K8s Applications mit MicroK8S auf Raspberry PI

Автор: Alfred Sabitzer

Издательство: Bookwire

Жанр: Математика

Серия:

isbn: 9783742770134

isbn:

СКАЧАТЬ protocol: TCP

       selector:

       app: getinfo

      ---

      Dieses yaml wenden wir nun im Cluster an.

      alfred@pc1:~$ k apply -f getinfo.yaml

      deployment.apps/getinfo created

      service/getinfo-service created

      alfred@pc1:~$ kubectl get all

      NAME READY STATUS RESTARTS AGE

      pod/webserver-slainte-67494d5d7b-hj99r 1/1 Running 22 67d

      pod/getinfo-6c84cff999-mtf5v 1/1 Running 0 89s

      NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE

      service/kubernetes ClusterIP 10.152.183.1 <none> 443/TCP 67d

      service/webserver-slainte ClusterIP 10.152.183.125 <none> 443/TCP 67d

      service/getinfo-service ClusterIP 10.152.183.43 <none> 8080/TCP 6m12s

      NAME READY UP-TO-DATE AVAILABLE AGE

      deployment.apps/webserver-slainte 1/1 1 1 67d

      deployment.apps/getinfo 1/1 1 1 6m12s

      NAME DESIRED CURRENT READY AGE

      replicaset.apps/webserver-slainte-67494d5d7b 1 1 1 67d

      replicaset.apps/getinfo-6c84cff999 1 1 1 89s

      replicaset.apps/getinfo-6659cf7655 0 0 0 6m12s

      Die Anzeige im Dashboard zeigt uns auch einen gut laufenden Pod.

      OEBPS/images/image0025.jpg Abbildung 23: GetInfo Pod im Dashboard

      Nun schauen wir, was der Pod zurückliefert:

      alfred@pc1:~$ curl http://10.152.183.43:8080/view/hello

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title> <meta name="generator" content="LibreOffice 7.1.6.2 (Linux)"/> <meta name="author" content="Alfred Sabitzer"/> <meta name="created" content="2021-10-07T16:33:50.696105947"/> <meta name="changedby" content="Alfred Sabitzer"/> <meta name="changed" content="2021-10-07T16:36:08.816466992"/> <style type="text/css"> @page { size: 21cm 29.7cm; margin: 2cm } p { margin-bottom: 0.25cm; line-height: 115%; background: transparent } td p { orphans: 0; widows: 0; background: transparent } </style></head><body lang="de-AT" link="#000080" vlink="#800000" dir="ltr"><p style="margin-bottom: 0cm; line-height: 100%"><p style="margin-bottom: 0cm; line-height: 100%"><br/></p><table width="100%" cellpadding="4" cellspacing="0"> <col width="64*"/> <col width="64*"/> <col width="64*"/> <col width="64*"/> <tr valign="top"> <td width="25%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p> OSENVIRONMENT</p> </td> <td width="25%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p> DISKUSAGE</p> </td> <td width="25%" style="border-top: 1px solid #000000; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0.1cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p> HOSTINFO</p></td> <td width="25%" style="border: 1px solid #000000; padding: 0.1cm"><p> MEMINFO</p> </td> </tr> <tr valign="top"> <td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p> PATH=>/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin<br>HOSTNAME=>getinfo-6c84cff999-mtf5v<br>GOLANG_VERSION=>1.16.9<br>GOPATH=>/go<br>FOO=>bar<br>WEBSERVER_SLAINTE_PORT_443_TCP=>tcp://10.152.183.125:443<br>GETINFO_SERVICE_SERVICE_PORT=>8080<br>GETINFO_SERVICE_PORT=>tcp://10.152.183.43:8080<br>GETINFO_SERVICE_PORT_8080_TCP=>tcp://10.152.183.43:8080<br>GETINFO_SERVICE_PORT_8080_TCP_PROTO=>tcp<br>GETINFO_SERVICE_PORT_8080_TCP_ADDR=>10.152.183.43<br>WEBSERVER_SLAINTE_SERVICE_PORT=>443<br>WEBSERVER_SLAINTE_PORT=>tcp://10.152.183.125:443<br>KUBERNETES_SERVICE_HOST=>10.152.183.1<br>KUBERNETES_PORT=>tcp://10.152.183.1:443<br>KUBERNETES_PORT_443_TCP=>tcp://10.152.183.1:443<br>KUBERNETES_PORT_443_TCP_PORT=>443<br>WEBSERVER_SLAINTE_SERVICE_HOST=>10.152.183.125<br>WEBSERVER_SLAINTE_SERVICE_PORT_HTTPS=>443<br>WEBSERVER_SLAINTE_PORT_443_TCP_PROTO=>tcp<br>KUBERNETES_SERVICE_PORT=>443<br>KUBERNETES_PORT_443_TCP_PROTO=>tcp<br>GETINFO_SERVICE_SERVICE_PORT_HELLO=>8080<br>GETINFO_SERVICE_PORT_8080_TCP_PORT=>8080<br>WEBSERVER_SLAINTE_PORT_443_TCP_PORT=>443<br>WEBSERVER_SLAINTE_PORT_443_TCP_ADDR=>10.152.183.125<br>KUBERNETES_SERVICE_PORT_HTTPS=>443<br>KUBERNETES_PORT_443_TCP_ADDR=>10.152.183.1<br>GETINFO_SERVICE_SERVICE_HOST=>10.152.183.43<br>HOME=>/root<br> </p> </td><td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p> Pfad:/<br>FSTYPE:<br>Total disk space: 58.3 GB<br>Free disk space: 46.1 GB<br>Used disk space: 9.7 GB<br>Used GB Prozent:17.4<br>Used Inodes:176202<br>Used Inodes Prozent:4.7 </p> </td> <td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: none; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0cm"><p> Hostname: getinfo-6c84cff999-mtf5v<br>OS: linux<br>Platform: alpine<br>Host ID(uuid): c1e70216-8eeb-4ca0-ac87-cf090dcc2c1f<br>Uptime (sec): 5085<br>Number of processes running: 1</p> </td> <td width="25%" style="border-top: none; border-bottom: 1px solid #000000; border-left: 1px solid #000000; border-right: 1px solid #000000; padding-top: 0cm; padding-bottom: 0.1cm; padding-left: 0.1cm; padding-right: 0.1cm"><p> OS : linux<br>Total memory: 7.6 GB<br>Free memory: 3.1 GB<br>Used memory: 2.0 GB<br>Percentage used memory: 26.48</p> </td> </tr> </table><p style="margin-bottom: 0cm; line-height: 100%"><br/></p><p style="margin-bottom: 0cm; line-height: 100%">Es ist <span style="background: #c0c0c0"><sdfield type=DATETIME sdval="44476,6908896088" sdnum="3079;3079;T. MMMM JJJJ">2021-10-15 20:00:26 Friday</sdf

      alfred@pc1:~$

      Sieht ganz gut aus:) Auch der Logoutput ist interessant:

      alfred@pc1:~$ kubectl logs getinfo-6c84cff999-mtf5v

      2021/10/15 19:58:40 Main Started

      2021/10/15 20:00:26 hello.html

      alfred@pc1:~$

      Um den Output richtig zu sehen, ändere ich zu Testzwecken den Typ des Services auf einen NodePort um den Service von außen erreichen zu können.

      alfred@pc1:~$ kubectl edit service getinfo-service

      service/getinfo-service СКАЧАТЬ