Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Thai

รู้เบื้องต้นเกี่ยวกับ Kubernetes


English

Kubernetes is the leading open source container orchestration platform. Originally created by Google based on their need to support massive scale, Kubernetes is now under the purview of Cloud Native Computing Foundation (CNCF), a vendor-neutral foundation managing popular open source projects.

There are several basic and essential concepts that need to be understood:


Thai

Kubernetes เป็นแพลตฟอร์มโอเพ่นซอร์สคอนเทนเนอร์ เดิมทีสร้างโดย Google ตามความต้องการของพวกเขาในการสนับสนุนขนาดใหญ่ตอนนี้ Kubernetes อยู่ภายใต้ขอบเขตของ Cloud Native Computing Foundation Computing Foundation (CNCF) สำหรับผู้ขายที่จัดการโครงการโอเพ่นซอร์สยอดนิยม

มีแนวคิดพื้นฐานและจำเป็นหลายประการที่ต้องเข้าใจ:

...

Thai

สร้างหน่วยเก็บข้อมูลถาวรโดยใช้ PersistentVolume and PersistentVolumeClaim

 

Code Block
kubectl apply -f https://k8s.io/examples/application/mysql/mysql-pv.yaml

...

Code Block
kubectl run -it --rm --image=mysql:5.68 --restart=Never mysql-client -- mysql -h mysql -ppassword

...

Once the MySQL database is running, let’s run a Docker image for Joget Enterprise that connects to that MySQL service.

1. Deploy joget image using an example YAML file. Download the contents of joget-dx7dx8-tomcat9-deployment.yaml into a file with the same name and run kubectl.

Thai

เมื่อฐานข้อมูล MySQL ทำงานแล้วให้เรียกใช้อิมเมจ Docker image for Joget Enterprise ที่เชื่อมต่อกับบริการ MySQL นั้น

1. ปรับใช้อิมเมจ joget โดยใช้ไฟล์ YAML ตัวอย่าง ดาวน์โหลดเนื้อหาของ joget-dx7dx8-tomcat9-deployment.yaml ลงในไฟล์ที่มีชื่อเดียวกันและรัน kubectl


View file
namejoget-dx7dx8-tomcat9-deployment.yaml
height250

Code Block
kubectl apply -f joget-dx7dx8-tomcat9-deployment.yaml

2. Inspect the deployment

...

Code Block
kubectl describe deployment joget-dx7dx8-tomcat9
kubectl get pods -l app=joget-dx7dx8-tomcat9

3. Once the STATUS is Running, get the URL for the service

...

Code Block
minikube service joget-dx7dx8-tomcat9 --url

4. Access the URL in a browser in the path to access the Joget App Center e.g. http://192.168.99.100:32496/

...

    1. Database Type: MySQL
    2. Database Host: the service name of the database e.g. mysql
    3. Database Port: 3306
    4. Database Name: jwdb
    5. Database User: root
    6. Database Password: the configured password e.g. password

Image RemovedImage Added


You now have a running installation of Joget, and you’ll be able to visually build a full app in 30 minutes without coding.

...

Code Block
kubectl scale --replicas=2 deployment joget-dx7dx8-tomcat9

2. Examine the running pods, and you should see 2 pods running Joget

...

Code Block
kubectl get pods
NAME                     READY STATUS RESTARTS   AGE
joget-dx7dx8-tomcat9-7d879db895-c9sbb   1/1 Running 0    27s
joget-dx7dx8-tomcat9-7d879db895-wpnsf   1/1 Running 0    37m
mysql-7b9b7999d8-lk9gq   1/1 Running 0    65m

...

Code Block
kubectl scale --replicas=1 deployment joget-dx7dx8-tomcat9

4. Examine the running pods, and you should now see 1 pod running Joget.

...

  1. Launch Joget from your browser and login as admin.
  2. Navigate to Settings > License.
  3. Your system key should contains dashes as the following. 

    If the system key matches any of the nodes listed at the bottom, then it is wrong.
  4. If it does not, chances are that you did not assign the service account cluster view permission for Joget to retrieve the deployment info.
    Check the logs to look for "io.kubernetes.client.openapi.ApiException: Forbidden".
    ERROR 14 Apr 2021 12:35:03 org.joget.apps.license.LicenseManager  - Forbidden
    io.kubernetes.client.openapi.ApiException: Forbidden
    	at io.kubernetes.client.openapi.ApiClient.handleResponse(ApiClient.java:971)
    	at io.kubernetes.client.openapi.ApiClient.execute(ApiClient.java:883)
    	at io.kubernetes.client.openapi.apis.CoreV1Api.readNamespacedPodWithHttpInfo(CoreV1Api.java:45995)
    	at io.kubernetes.client.openapi.apis.CoreV1Api.readNamespacedPod(CoreV1Api.java:45965)
    	at org.joget.apps.license.LicenseManager.generateK8sDeploymentSystemKey(LicenseManager.java:934)
    	at org.joget.apps.license.LicenseManager.generateClusterSystemKey(LicenseManager.java:854)
    	at org.joget.apps.license.LicenseManager.checkClusterLicense(LicenseManager.java:1055)
    	at org.joget.apps.license.LicenseManager$4.run(LicenseManager.java:1029)


  5. The "io.kubernetes.client.openapi.ApiExceptionForbidden"exception shows this permission is missing. You may need to change namespace value if they are not using the default namespace. Once that you have resolved this error, then only the system key would change back to using the deployment ID.

  6. The following in the YAML file.

    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      name: joget-dx7dx8-tomcat9-clusterrolebinding
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: view
    subjects:
      - kind: ServiceAccount
        name: default
        namespace: default

    is to assign the service account cluster view permission to retrieve Deployment info for the license system key.
  7.  If the RBAC settings of the Kubernetes cluster doesn't allow the use of ClusterRole, you can create a Role and RoleBinding to retrieve the Joget deployment info for the license system key. Use the YAML file below;

---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: deployment-info-role
  namespace: <namespace-here>
rules:
-  apiGroups: ["apps"]
   resources: ["replicasets"]
   verbs: ["get", "list", "watch"]
-  apiGroups: [""]
   resources: ["pods"]
   verbs: ["get", "list", "watch"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  name: deployment-info-rolebinding
  namespace: <namespace-here>
subjects:
  - kind: ServiceAccount
    name: default
    namespace: <namespace-here>
roleRef:
  kind: Role
  name: deployment-info-role
  apiGroup: rbac.authorization.k8s.io