Category: Uncategorized

  • Kubernetes: Traefik Middleware

    Traefik’s Middleware in Kubernetes is a type of CustomResourceDefinition (CRD). This means that it is not natively supported by Kubernetes. To get the list of CRD: To get the list of Traefik’s Middlewares:

  • Linux: DD Bytes

    Create 1G file in PC with 1G of RAM: This is because the command is creating 1G of data in MEMORY before writing it to disk. Workaround: This will create 100M data in memory then writing it to disk while creating the second 100M and so on.

  • Javascript: Window Location (URL)

    Say we have this URL: window.location.protocol is http: window.location.host is 127.0.0.1:5000 window.location.hostname is 127.0.0.1 window.location.port is 5000 window.location.pathname is /index.html window.location.search is ?a=111&b=222 window.location.hash is #x=888&y=999 For full property, you can type window.location in the console log. References:

  • Microsoft Graph: User Authentication with Javascript (SPA)

    First you need to: 1. Register your application. 2. Set the callback URI redirect. Then you add Microsoft Authentication Library (MSAL.js): Once you complete the sign-in process, you will get an access_token. At this point, you can use the access_token with Microsoft Graph API. But because we have our own backend resources, We want to…

  • Microsoft Graph: User Authentication with PHP (WebApp)

    First you need to: 1. Register your application, 2. Set the callback URL redirect. 3. Create a client secret key. state (recomended): A value included in the request that’s also returned in the token response. It can be a string of any content that you wish. A randomly generated unique value is typically used for preventing…

  • S3: Set CORS

    Create an XML file: Then apply it with: You can check the CORS with: To remove CORS: References:

  • K3S: Built-in Traefik

    To configure the built-in Traefik, first we create a new YAML file: Apply the new YAML file with kubectl. To revert back to original config: References:

  • Kubernetes: Traefik IngressRoute

    IngressRoute is Traefik CustomResourceDefinition (CRD). It is used to manage access external access to the services. Same function as Ingress, just different implementations. Middleware is also Traefik CustomResourceDefinition (CRD). It is used to “tweak” your request and/or response. Using Ingress, we apply the Middleware by adding it as an annotations. Using IngressRoute, we define the…

  • Kubernetes: User Authorization with Certificate

    Generate a private key: Generate a certificate signing request (csr) from private key: CN is the user, O is the group. We create CertificateSigningRequest to Kubernetes: .spec.signerName read here. Once you send the CSR, you can query it with: Now Admin will approve/deny the CSR: Once you got approved, fetch the signed certificate and wrap…

  • Kubernetes: RoleBinding, ClusterRoleBinding

    RoleBinding in Kubernetes is used to tie together ServiceAccount and/or User and/or Group to particular Role/ClusterRole. RoleBinding is limited within a particular namespace, whereas ClusterRoleBinding is global. Binding Role to ServiceAccount : Binding Role to User: Binding Role to Group: Once you bind, you can check the permission with: Refrences: