<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Authapon Kongkaew on Medium]]></title>
        <description><![CDATA[Stories by Authapon Kongkaew on Medium]]></description>
        <link>https://medium.com/@ohmrefresh?source=rss-490d3e1f0069------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Qj1UD1wBtzMMROePvYKPiA.jpeg</url>
            <title>Stories by Authapon Kongkaew on Medium</title>
            <link>https://medium.com/@ohmrefresh?source=rss-490d3e1f0069------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 01:12:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ohmrefresh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[[101] Part 2 Deploy React Component to Nexus]]></title>
            <link>https://medium.com/@ohmrefresh/101-part-2-deploy-react-component-to-nexus-c295ac86f07e?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/c295ac86f07e</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-components]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Fri, 25 Sep 2020 07:30:21 GMT</pubDate>
            <atom:updated>2020-09-25T07:30:21.606Z</atom:updated>
            <content:encoded><![CDATA[<p>ต่อจาก Part ที่แล้ว <a href="https://medium.com/@ohmrefresh/101-setup-sonatype-nexus-repository-%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A-nodejs-module-local-registry-878edbfe7140">[101]Setup Sonatype Nexus Repository สำหรับ Nodejs Module(Local registry)</a> หลักจากที่ได้สร้าง nexus server</p><p><strong>React Component</strong></p><p><strong>ทำไมถึงต้องสร้าง Component</strong></p><ul><li>เพื่อให้สามารถ Re-used source code ได้อย่างมีประสิทธิภาพ ลด Duplicate Code ในหลายๆ Projects</li></ul><p><strong>1)เริ่มต้นสร้าง Component ในที่นี้ขอสร้างเป็น react library</strong></p><pre>npx create-react-library &lt;component package&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kIZr2eMmh9ams0ub3UyFbQ.png" /><figcaption>ผลลัพท์หลังจากรัน</figcaption></figure><p><strong>2)สร้างไฟล์ .npmrc</strong></p><ul><li>registry ใช้สำหรับระบุ npm registry ในนี้ที่ระบุเป็น “http://127.0.0.1:8081/repository/npm-group”</li><li>_auth เป็น bear token ที่ใช้ Authentication กับ nexus server วิธีการสร้าง ในนำ user:password ของ nexus ไป encrypt ด้วย base64</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/79c44ac9fa9a6a9ba4f78c8534f02427/href">https://medium.com/media/79c44ac9fa9a6a9ba4f78c8534f02427/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BruMACIb3UvQW2q5O0wUjw.png" /><figcaption>โครงสร้างของโฟลเดอร์ใน Project</figcaption></figure><p><strong>3)เพิ่ม publishConfig ในไฟล์ package.json</strong></p><pre>“publishConfig”: {</pre><pre>     “registry”: “http://127.0.0.1:8081/repository/npm-private/&quot;</pre><pre>}</pre><p><strong>4) เพิ่ม custom script ภายใต้ Tag script สำหรับใช้ publish package ไปยัง nexus</strong></p><pre>“publish-my-org”: “npm publish — registry http://127.0.0.1:8081/repository/npm-private/&quot;</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe3164b9498175fa90b60f8668a5d6d3/href">https://medium.com/media/fe3164b9498175fa90b60f8668a5d6d3/href</a></iframe><p><strong>5) Deploy package ไปยัง nexus</strong></p><pre>npm run publish-my-org</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*0ms8QU_KNl96ivBJWb3sQw.png" /><figcaption>Output หลังจากการรัน</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4z2C4SoQQli66nb-Cbwqug.png" /></figure><p>ตัวอย่าง Projects <a href="https://github.com/ohmrefresh/demo-react-components/tree/master/components/demo-component">https://github.com/ohmrefresh/demo-react-components/tree/master/components/demo-component</a></p><blockquote>และแล้วในสุดเราก็ได้ Package ที่อยู่ใน Nexus Server Part ถัดไปจะมาต่อด้วยการนำ Component ไปใช้งานจริง</blockquote><p>[101] Part 3 How to use React Component from nexus to our projects</p><p>[101] Part 4 Auto Document on React Component</p><p>[101] Part 5 Jenkins pipeline for deploy react component</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c295ac86f07e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[101]Setup Sonatype Nexus Repository สำหรับ Nodejs Module(Local Registry)]]></title>
            <link>https://medium.com/@ohmrefresh/101-setup-sonatype-nexus-repository-%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A-nodejs-module-local-registry-878edbfe7140?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/878edbfe7140</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[nexus]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Fri, 25 Sep 2020 07:30:02 GMT</pubDate>
            <atom:updated>2020-09-25T07:30:58.448Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Nexus คือไร</strong></p><p>ตอบแบบกำปั้นทุบดิน คือ Repository Management เพื่อใช้สำหรับจัดเก็บ Library โดยความสามารถหลัก Dependency management</p><p>ในแต่ละบริษัทสาย Tech มักมี Library ที่เป็น Internal Library ที่สร้างขึ้นมาเพื่อใช้งานภายในบริษัทเท่านั้น อาจด้วยเหตุผลเรื่อง Data Privacy หรือเหตุผลอื่นๆ เลยมีความจำเป็นต้องสร้าง Private Local Registry ไว้ใช้งานภายในองค์กร</p><p><strong>แล้วทำไมต้องใช้ Nexus</strong></p><ul><li>Free (**มี Version เสียตังค์)</li><li>รองรับหลากหลาย Package ทำให้สามารถใช้ร่วมกับการพัฒนาได้หลายภาษา เช่น Python, Java, Docker, npm …</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sykOh49vPpEPHPIlbEa0_g.png" /><figcaption><a href="https://help.sonatype.com/repomanager3">Repositories ที่ nexus รองรับ</a></figcaption></figure><p>ในที่นี่ขอรัน N<a href="https://hub.docker.com/r/sonatype/nexus3">exus บน Docker</a></p><ol><li>สร้าง Volume สำหรับเก็บ Persistence data</li></ol><pre>docker volume create --name nexus-data </pre><blockquote>2.2 Start Nexus โดยใช้ Volume ที่สร้างในขั้นตอนก่อนหน้า</blockquote><pre>docker run -d -p 8081:8081 --name nexus -v nexus-data:/nexus-data --restart always sonatype/nexus3</pre><p>3. เปิดหน้า Browser <a href="http://127.0.0.1:8081/">http://127.0.0.1:8081</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*99-y5eB1f1NVeUuMDEkjog.png" /><figcaption>หน้าแรกที่เจอ จะถามหา admin password</figcaption></figure><p>ตามหา Admin Password รัน Command ด้านล่าง แล้วจะได้ Password เพื่อนำไปใช้ Login</p><pre>docker exec -it nexus cat /nexus-data/admin.password</pre><p>4. ปิดการเข้าถึงแบบไม่ผ่านการ Authen (Disable Anonymous access)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KJWlXVf7O-GWdY6x4xMNHQ.png" /><figcaption>ขั้นตอนนี้สำคัญ ***Disable anonymous access อย่าเผลอเปิดให้คนอื่นมาใช้</figcaption></figure><p>5. เริ่ม Config Repository เลือกเป็น npm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VA-DI0aEcrTyrI5CeG_Aiw.png" /></figure><p>6. สร้าง Repository เลือกเป็น Proxy mode</p><p>จุดสำคัญคือตรง Remote storage เป็น <a href="https://registry.npmjs.org/">https://registry.npmjs.org/</a> เพื่อให้ Nexus สามารถออกไปหา Package ที่ไม่มี Local Repository ได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZEHDtI9JTw_it0XkBgPOTg.png" /><figcaption>ตั้งชื่อเป็น npm-proxy และ config remote storage</figcaption></figure><p>7. สร้าง Repository npm เป็น Mode Hosted เพื่อใช้สำหรับเก็บ Private Package</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mLuWsTeamxUf4cqURWskoA.png" /><figcaption>ตั้งค่า npm-proxy **Deploy policy ควรเลือก disable redeploy เพื่อป้องการความผิดพลาดในการ release</figcaption></figure><p>8. สร้าง Repository npm เป็น Mode group เพื่อใช้รวม Mode Proxy และ Mode Private เข้าด้วยกัน เวลาใช้งานจริง จะใช้งานผ่าน npm-group</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OnIzHnmmZAJED1gTZKDvxw.png" /><figcaption>เพิ่ม member npm-proxy, npm-private</figcaption></figure><p>9. ตั้งค่าการ Authentication ระหว่าง Client กับ Nexus Server ให้เลือก npm Bearer Token Realm</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SZk5oQmi30Wbus9l3dwpoA.png" /><figcaption>เปิดใช้งานการเข้าถึง nexus ด้วย npm Bearer Token Realm</figcaption></figure><p>10. สร้าง Roles สำหรับ Users เพื่อให้สะดวกในการจัดการสิทธิการเข้าถึง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_8QG_-nNOOi51wehixDohg.png" /><figcaption>สร้าง Roles developer แล้วเลือกสิทธิที่ให้ developer ใช้งาน</figcaption></figure><p>11. สร้าง Users และกำหนด Roles</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*InJAIDFzmpZvZ19GVWBbUA.png" /><figcaption>สร้าง User และระบุ Role ในการเข้าถึง</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGbP9yYrK901go6I5MAeQA.png" /><figcaption>Repository ที่ได้ตั้งค่าในขั้นตอนก่อนหน้า</figcaption></figure><p>*** ในที่สุดเราก็ได้ Nexus Server ส่วนตัวใช้ละ Part ต่อไปด้วยการ Deploy React Component ไปยัง Nexus Server ที่เราสร้างขึ้นมา</p><p><a href="https://medium.com/@ohmrefresh/101-part-2-deploy-react-component-to-nexus-c295ac86f07e">[101] Part 2 Deploy React Component to Nexus</a></p><p>[101] Part 3 How to use React Component from Nexus to our projects</p><p>[101] Part 4 Auto Document on React Component</p><p>[101] Part 5 Jenkins pipeline for deploy react component</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=878edbfe7140" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[OCP][101] SVC ทำงานยังไง part 1]]></title>
            <link>https://medium.com/@ohmrefresh/ocp-101-svc-%E0%B8%97%E0%B8%B3%E0%B8%87%E0%B8%B2%E0%B8%99%E0%B8%A2%E0%B8%B1%E0%B8%87%E0%B9%84%E0%B8%87-part-1-32dae7163d33?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/32dae7163d33</guid>
            <category><![CDATA[csv]]></category>
            <category><![CDATA[101]]></category>
            <category><![CDATA[openshift]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[ocp]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Sun, 20 Sep 2020 09:31:09 GMT</pubDate>
            <atom:updated>2020-09-20T09:31:09.166Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>SVC คืออะไร</strong></p><p>Internal loadbalance ในโลกของ kubernetes ที่ทำหน้าที่รับ connection แล้วกระจายโหลดไปยัง pods ต่างๆให้ถูกต้อง โดย pods ที่มาเรียกใช้งาน จะรู้จัก service ปลายทางในรูปแบบ naming เช่น app01.demo-project.svc</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*JZEx6dq86NjVyU-X9iRE8g.png" /><figcaption>ตัวอย่าง yaml ไฟด์ สำหรับ config service</figcaption></figure><p><strong>Yaml ไฟด์ ประกอบด้วย อะไรบ้าง</strong></p><ol><li>metadata มี name ชื่อขอ service</li><li>spec ประกอบด้วย</li></ol><blockquote>Port คือ port ที่เปิดรับจาก connection จาก pods อื่น มาเรียกใช้งาน</blockquote><blockquote>targetPort คือ port ที่ application เปิดรับ</blockquote><blockquote>selector คือ pods ที่เลือกใช้ policy นี้ (ในตัวอย่าง เลือก pods ที่ติด label appName เป็น app01</blockquote><blockquote>type คือประเภทของ loadbalance จากตัวอย่างระบุเป็น clusterIP</blockquote><p><strong>จะดู config svc ได้ยังไง?</strong></p><p>ใช้ oc command “oc get svc”</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4094c4d28e01389042552797e65ca78d/href">https://medium.com/media/4094c4d28e01389042552797e65ca78d/href</a></iframe><blockquote>Name คือชื่อของ SVC</blockquote><blockquote>Type คือประเภทของ Loadbalance (ClusterIP,NodePort,..)</blockquote><blockquote>Cluster-IP คือ IP ที่ pods มาเรียกเห็น</blockquote><blockquote>Port คือ port ที่เปิดให้ service อื่นเข้ามาใช้งาน</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df9bb1d404131f270f7377c29fd17f14/href">https://medium.com/media/df9bb1d404131f270f7377c29fd17f14/href</a></iframe><p><strong>IPTable หน้าทำงานยังไง?</strong></p><p><strong>กรอบสีแดง (1)</strong></p><p>service เปิดรับ IP range 10.128.0.0/14(-s) เข้าใช้งาน IP 172.30.136.125/32(-d) ด้วย port 8443 (-dport) Protocols ที่อณุญาติ TCP (-m) ในส่วนของ KUBE-SVC-HKZYJL05TFDCYS7I (-J) จะเป็น Key ที่ใช้อ้างอิงในขั้นตอนหาว่า connection ที่เข้ามาจะตก Pods ใด</p><p><strong>กรอบสีเขียว (2) **App มี 4pods</strong></p><p>Random (-mode) ที่ใช้ในการเลือก Pods โดยคิดค่าความเป็นได้เป็น 0.250000000000 (-probability) ความหมายคือมีความเป็นได้ที่ Connection จะเลือกใช้ pods ที่ 1 25 เปอร์เซ็นต์ โดยคิดจาก pods ทั้งหมด 4 pods ส่วน KUBE-SEP-GLTDMJISNXQTRVXI (-j) คือ Pods ที่เป็นตัวเลือก (1)</p><p>Row ที่ 2 ความเป็นได้ว่า connection จะมาตก pods ที่ 2 ความเป็นไปได้เป็น 0.333339999982 (-probability) ** คิดจาก 3 pods ที่เหลือ</p><p>Row ที่ 3 ความเป็นได้ว่า connection จะมาตก pods ที่ 3ความเป็นไปได้เป็น 0.500000000000 (-probability) ** คิดจาก 2 pods ที่เหลือ</p><p>Row ที่ 4 ความเป็นได้ว่า connection จะมาตก pods ที่ 4 ความเป็นไปได้เป็น 100% เพราะไม่มีตัวเลือกอื่นแล้ว</p><p><strong>กรอบสีม่วง (3)</strong></p><p>จะใช้ Key (-j) จาก ขั้นตอน เลือก Pods (กรอบสีเขียว) มาอ้างอิงหา (-A) เพื่อพา connection นั้นๆ ไปยัง IP จริงของ pods</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nyW9utL1_bi4hOQiuhoewg.png" /></figure><p><strong>ลำดับการเข้าถึงในกรณีต่างๆ</strong></p><p>ระบบสุ่มมา แล้วได้ Pods 1</p><blockquote>10.128.0.1(Service B) ==&gt; 172.30.136.125 ==&gt; 10.129.25.24 (app01)</blockquote><p>ระบบสุ่มมา แล้วได้ Pods 2</p><blockquote>10.128.0.1(Service B) ==&gt; 172.30.136.125 ==&gt; 10.129.25.25 (app01)</blockquote><p>ระบบสุ่มมา แล้วได้ Pods 3</p><blockquote>10.128.0.1(Service B) ==&gt; 172.30.136.125 ==&gt; 10.129.25.26 (app01)</blockquote><p>ระบบสุ่มมา แล้วได้ Pods 4</p><blockquote>10.128.0.1(Service B) ==&gt; 172.30.136.125 ==&gt; 10.129.25.27 (app01)</blockquote><p>ในการใช้งานจริงผู้ใช้งานมักเจอปัญหาเรื่อง Load ไม่ Balance ก็ไม่ต้องแปลกใจ :) เพราะ Algorithm ในการเลือก pods เป็น Randoms มันจะไม่ฉลาดแบบ HAProxy, Nginx, F5, .. ที่ใช้ Algorithm (round robin, Least Connections, ..<strong>)</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32dae7163d33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Hack] Bypass Jenkins authentication]]></title>
            <link>https://medium.com/@ohmrefresh/hack-bypass-jenkins-authentication-bdaf384deba2?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdaf384deba2</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[hacks]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Sun, 26 Apr 2020 08:43:28 GMT</pubDate>
            <atom:updated>2020-04-26T08:57:34.751Z</atom:updated>
            <content:encoded><![CDATA[<p>** This method need permission to ssh to server</p><figure><img alt="I can’t access jenkins. (Forget password,…, etc.)" src="https://cdn-images-1.medium.com/max/400/1*8eGqhdR8PSNtEaTnqGDWFQ.png" /><figcaption>I can’t access Jenkins (forgot my password, …, etc.) 😥😥😥😥😥</figcaption></figure><p><strong>Solution</strong></p><ol><li>Open terminal then ssh to jenkins server</li><li>Find Jenkins Home Path (default path : /var/lib/jenkins)</li><li>open file config.xml, then find &lt;useSecurity&gt; update flag from true to false</li><li>Restart Jenkins by command “<strong><em>sudo</em></strong> <strong><em>service jenkins restart</em></strong>”</li></ol><p>** Then you can have GOD permission on Jenkins 😁 😁</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*fFCgWaiQvG2Tb40ow8WAJg.png" /><figcaption>default config.xml (Jenkins)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*I2qweSppVYMWYh3kcQ8D0w.png" /><figcaption>After change useSecurity flag (config.xml)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*VuJ1Hi8V3T6OZemsGeo2EQ.png" /><figcaption>Done for bypass authentication :)</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdaf384deba2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[OCP 101] Network Policy แบบง่ายๆๆ]]></title>
            <link>https://medium.com/@ohmrefresh/ocp-101-network-policy-%E0%B9%81%E0%B8%9A%E0%B8%9A%E0%B8%87%E0%B9%88%E0%B8%B2%E0%B8%A2%E0%B9%86%E0%B9%86-9ff77b474209?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ff77b474209</guid>
            <category><![CDATA[openshift]]></category>
            <category><![CDATA[ocp]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Fri, 04 Oct 2019 16:13:59 GMT</pubDate>
            <atom:updated>2019-10-05T03:40:19.169Z</atom:updated>
            <content:encoded><![CDATA[<p>Network policy ใน Openshift เป็นการกำหนดสิทธิ เข้าถึง Pods (service) สามารถจำกัดสิทธิในการเข้าถึง แต่ละ Service ว่าจะให้ Component ใด สามารถ access ได้บ้าง ทาง Red hat ได้ provide วิธี config ผ่าน yaml ไฟด์ กับ json ไฟด์ ให้เลือกใช้งานตามความถนัด</p><p><strong>Network policy อยู่ตรงไหน ?</strong></p><p>UI Mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*i2zAJMLIB5YpU4Tarc-JtQ.png" /><figcaption>เมนู Applications ==&gt; Other Resources</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*LRGA9IRbncX9_q2ht_2vwA.png" /><figcaption>เลื่อนหา Network Policy แล้วจะเห็น network policy ทั้งหมด ที่อยู่ใน namespace นั้นๆ</figcaption></figure><p><strong>Command Mode</strong></p><p><strong>Basic</strong></p><p>oc get networkpolicy -n name-space-xxx .</p><p><strong>Advance</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/401f60b92928138a82e70fb375a7b452/href">https://medium.com/media/401f60b92928138a82e70fb375a7b452/href</a></iframe><p><strong>ตัวอย่างการนำ network policy ไปใช้งาน</strong></p><blockquote>สมมุติว่ามี component banana-app เขียนด้วย Spring boot แล้วมี service banana-leaf เขียนด้วย PHP (Laravel Framework) ต้องการเรียกงาน ต้อง Config อย่างไร</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*bVIZZItEigeUYFXlYuaNcw.png" /><figcaption>Flow จะเป็นประมาณนี้</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*44y2GlPVtu1VZXdIZiVcVw.png" /><figcaption>ตัวอย่าง Yaml ที่ใช้ Config network policy <a href="https://gist.github.com/ohmrefresh/ab917564615dbae8f6c71f523271c3f9">https://gist.github.com/ohmrefresh/ab917564615dbae8f6c71f523271c3f9</a></figcaption></figure><p>แต่ละส่วนใน Yaml คืออะไร</p><p><strong>เบอร์ 2</strong> ชื่อที่จะใช้ตั้ง Freestyle</p><p><strong>เบอร์ 3</strong> Namespace ที่จะถูกสร้าง Policy</p><p><strong>เบอร์ 4</strong> จะให้ Component ใด เรียกได้บ้าง จากตัวอย่าง จะรับ connection ที่มาจาก pod ที่มี appName “banana-leaf-app-destination” และต้องมาด้วย port 8443</p><p><strong>เบอร์ 5</strong> policy นี้จะใช้กับ pod ไหน ในตัวอย่างจะเป็น รับ connection ที่มาจาก pod ที่มี Label appName เป็น “banana-app”</p><blockquote>[metadata เป็น freestyle label สามารถกำหนดได้ ตามรูปแบบที่จะนำไปใช้งานได้]</blockquote><p><strong>เพิ่มหรือแก้ไข Network Policy ต้องทำอย่างไร ??</strong></p><p>UI Mode</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*zh7InykI0sKAcUxJfKJM_A.png" /><figcaption>Copy Yaml ไฟด์ แล้วกด Create</figcaption></figure><p><strong>Command mode</strong></p><p>oc create -f policy.yml -n fruit</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ff77b474209" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[OCP 101] How to terminate pods with OC command]]></title>
            <link>https://medium.com/@ohmrefresh/ocp-101-how-to-terminate-pods-with-oc-command-7eed0dcb2b0a?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/7eed0dcb2b0a</guid>
            <category><![CDATA[ocp]]></category>
            <category><![CDATA[openshift]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Fri, 27 Sep 2019 15:27:54 GMT</pubDate>
            <atom:updated>2019-09-27T15:29:47.925Z</atom:updated>
            <content:encoded><![CDATA[<p>Kill pods state in [Error, MatchNodeSelector, CrashLoopBackOff]</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/433676b464f52494a7b19bf0c3c0c0da/href">https://medium.com/media/433676b464f52494a7b19bf0c3c0c0da/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7eed0dcb2b0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tuning SQL [Part 2]]]></title>
            <link>https://medium.com/@ohmrefresh/everything-has-challenge-part-2-709897f397aa?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/709897f397aa</guid>
            <category><![CDATA[challenge]]></category>
            <category><![CDATA[optimize]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Sun, 04 Dec 2016 04:04:41 GMT</pubDate>
            <atom:updated>2016-12-06T17:08:20.078Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o7eq--GetKYT1Vv0sMLMNA.jpeg" /><figcaption>รูปไม่เก่ียวกับ content</figcaption></figure><p>ปัญหาเดิม ที่แก้ไปแล้ว สามารถแก้ปัญหาได้ประมาณ 70% จะทำยังไงให้ได้ 100% ผมเจอโจทย์เดี่ยวกันกับ Report ที่แสดงผลช้ามากๆๆๆๆๆๆๆๆๆ</p><p>การที่เราจะ SQL tuning performance นั้น สิ่งที่จำเป็นมากที่สุดคือ Privilege ในการ เข้าถึง Database <em>(ซึ่งผมไม่มีสิทธินั้น)</em></p><ol><li>System Privilege ADVISOR ควรมีสิทธินี้</li><li>สิทธิในการ access V$MYSTAT.</li><li>ควรรู้ด้วยว่า มี DB Engine Status ณ ขณะนั้นเป็น อย่างไร CPU, Memory, etc.</li></ol><p>ต่อให้ เรา optimize ไปเท่าไหรหากเครื่องไม่ allocate resouce มาให้เราได้ ก็ไม่มีความหมาย</p><p>DB Engine ของ Oracle จะมี Hint ที่เอาไว้ optimize query แต่เราเองไม่กล้าใส่เพราะ หากใส่โดยที่เราไม่รู้ว่า resouce ของเครื่องเป็นอย่างไร สักวันหนึ่งมันจะพังใส่เราได้</p><pre>SELECT /*+ parallel(10) */ ename, dname FROM emp e, dept d<br>WHERE e.deptno=d.deptno;</pre><p>ตัวเลข 10 ใน query คือ Degree โดยมีสูตรคำนวณ <em>(ทุกอย่างมีต้นทุน ใส่เยอะ เครื่องจะไหวหรือเปล่า ลองนึกภาพหาก User 100k คน เรียกพร้อมกันจะเกิดอะไรขึ้น คล้ายๆกับ nginx ที่มักจะมี admin ใส่จำนวน connection ที่เยอะ แต่ไม่คิดถึง Resouce)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*WAnY9m2NXgxGaHgmrvSPdA.png" /><figcaption><a href="https://docs.oracle.com/cd/E11882_01/server.112/e25523/parallel002.htm">https://docs.oracle.com/cd/E11882_01/server.112/e25523/parallel002.htm</a></figcaption></figure><p>ผมเลือกแก้ปัญหาแบบปลอดภัยที่สุด คือไม่ระบุตัวเลข degree ปล่อยให้ DB Engine จัดการให้</p><pre>SELECT /*+ parallel */ ename, dname FROM emp e, dept d<br>WHERE e.deptno=d.deptno;</pre><p>ใส่แล้วมันดีขึ้นหรือเปล่า</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/1*pFrREsqhmFdYTHcYVsOCxg.png" /><figcaption>ไม่ใส่ Hint /Cost = 178</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*XqdXyZ1BGFxinCLaGPHJmQ.png" /><figcaption>ใส่ Hint /*+ parallel */ cost = 16</figcaption></figure><blockquote><strong>ค่า Cost ลดลง 91.01% ที่เหลือก็แล้วแต่บุญแต่กรรม 555</strong></blockquote><blockquote>**Query ที่ใช้ทดสอบ Optimize มาระดับหนึ่งแล้ว เพิ่ม แค่ Hint ชีวิตก็เปลี่ยน อาทิตย์หน้าจะรอดูว่าจะตอบโจทย์หรือเปล่า</blockquote><blockquote>07/12/2016 Alpha =&gt;pass| Staging =&gt; pass| Production =&gt;<strong>Fail</strong></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=709897f397aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tuning SQL [Part 1]]]></title>
            <link>https://medium.com/@ohmrefresh/everything-has-challenge-part-1-70b5af3c5b25?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/70b5af3c5b25</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[challenge]]></category>
            <category><![CDATA[query-tuning]]></category>
            <category><![CDATA[stored-procedure]]></category>
            <category><![CDATA[query-optimization]]></category>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Sat, 03 Dec 2016 13:14:44 GMT</pubDate>
            <atom:updated>2016-12-06T17:06:52.491Z</atom:updated>
            <content:encoded><![CDATA[<p>หลังจากที่ผมได้เปลี่ยนงานใหม่มาได้ประมาณ 2 เดือน มีประสบการณ์หลายอย่างที่ได้ทำในบริษัทแห่งหนึ่ง เป็นสิ่งที่ท้าท้ายมาก</p><p>เริ่มด้วยการแก้ปัญหาของ Stored Procedure ที่เป็นปัญหามายาวนาน คำถามแรกที่ผมมีคือ ถ้าแก้ง่าย ทำไมไม่มีใครแก้ หรือบางทีอาจจะแก้ง่ายแต่ไม่อยากทำ regression test <em>“ข้อมูลใน database มีข้อมูลวิ่งเข้าเป็นหลักล้านต่อวัน”</em></p><p><strong>Problem</strong></p><ul><li>Large Data จำนวน record ต่อวันที่มีเยอะมาก ประมาณ 2 ล้าน record ต่อวัน ข้อมูล หรืออาจจะมากกว่านั้น</li><li>Execute แล้ว DB Procedure ตาย ต้อง run ซ่อม</li></ul><p><strong>Root Cause</strong></p><ul><li>Query Not optimize: ไม่มีการระบุ partition ในการ query ทำให้ในการ query แต่ละครั้งมีค่า Cost ที่สูง ทำกิน resouce ของ DB Server ค่อนข้างเยอะ สุดท้ายส่งผลให้ response time สูงขึ้นเป็นเงาตามตัว</li></ul><p><strong>Solve</strong></p><ul><li>ระบุ partition ใน query เพื่อเพิ่มประสิทธิภาพในการ query <strong>(way 1)</strong></li></ul><p>แบบไม่ใช้ partition</p><pre>mysql&gt; <strong>SELECT id, CONCAT(fname, &#39; &#39;, lname) AS name</strong><br>    -&gt;     <strong>FROM employees ORDER BY lname;</strong></pre><p>แบบใช้ partition</p><pre>mysql&gt; <strong>SELECT id, CONCAT(fname, &#39; &#39;, lname) AS name</strong><br>    -&gt;     <strong>FROM employees PARTITION (p0) ORDER BY lname;</strong></pre><p>Partition มันมีดีอย่างไร</p><p>Database Engine เวลา query จะรู้ว่า data ชุดดังกล่าวอยู่ตรงส่วนใดของ Table ลองมองนึกภาพ หากมีข้อมูลจำนวน 100 ล้าน rows ถ้าไม่มีการจัดการเรื่อง partition Query จะหาจาก 100 ล้าน rows แต่ถ้าหากมี partition ก็อาจจะหาจากแค่ 8.33 ล้าน (100/12) rows ก็อาจเป็นได้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*bP3-rwqgit9RXjtHtiCDfg.png" /><figcaption>Table with out Partition VS with Partition</figcaption></figure><p><strong>Notes</strong></p><ul><li>หากออกแบบ Database schema ดี จะไม่เป็นภาระแก่ลูกหลาน ควรออกแบบเผื่อคนที่จะ Query ควรรู้ว่าเวลานำไปใช้ จะใช้อะไรบ้าง</li><li>Partition ใน database จะถูกจัดการให้อัตโนมัติ ตาม condition ในการสร้าง แต่เวลาใช้งาน ต้องระบุ partition ใน query เพื่อให้ Database Engine รู้ว่า data ที่คุณต้องการค้นหา อยู่ในส่วนไหน ของ Table</li><li>หาก Database เป็น DB เป็นลักษณะ remote link จะไม่สามารถ query โดยใช้ชื่อ Partition ได้ ต้องระบุเป็น เป็น Partition ID แทน “case นี้เจอใน oracle”</li><li>อยากรู้ว่าช้าเพราะอะไรใช้ Explain plan</li><li>Index ใส่มั่วซั่ว วันนี้อาจจะเร็ว แต่วันข้างหน้า จะมีปัญหา เลือกใช้กับจุดที่ควรใช้</li><li>PostgreSQL version เก่าๆจะมีปัญหา ในการใช้ count แค่ count ก็ช้าได้ ถ้าเป็นข้อมูลที่ไม่ซีเรียจมาก ก็ใช้ ลองใช้ count_estimate</li></ul><blockquote><strong>อีกวิธีในการแก้ปัญหา</strong></blockquote><blockquote>แก้ด้วยเงิน เปลี่ยน Harddisk ของ DB Server เป็น SSD เพื่อให้มีค่า IOPS สูง</blockquote><blockquote>Knowledge ส่วนนี้ต้องขอบคุณ บริษัทคนไทยรายใหญ่แถวๆ เมืองเอก , บริษัทคนญีปุ่นแห่งหนึ่งย่านสีลม และบริษัทเอเจนทัวร์แห่งหนึ่งในภูเก็ต สุดท้ายต้องขอบคุณบริษัทแห่งนี้ ที่ให้โอกาสเรา</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70b5af3c5b25" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[เมื่อคุณโอกาส มาเคาะประตูชีวิต]]></title>
            <link>https://medium.com/@ohmrefresh/%E0%B9%80%E0%B8%A1%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%84%E0%B8%B8%E0%B8%93%E0%B9%82%E0%B8%AD%E0%B8%81%E0%B8%B2%E0%B8%AA-%E0%B8%A1%E0%B8%B2%E0%B9%80%E0%B8%84%E0%B8%B2%E0%B8%B0%E0%B8%9B%E0%B8%A3%E0%B8%B0%E0%B8%95%E0%B8%B9%E0%B8%8A%E0%B8%B5%E0%B8%A7%E0%B8%B4%E0%B8%95-7d21c89969bf?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d21c89969bf</guid>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Tue, 22 Nov 2016 14:18:10 GMT</pubDate>
            <atom:updated>2016-11-22T14:18:10.856Z</atom:updated>
            <content:encoded><![CDATA[<p>เมื่อคุณโอกาส มาเคาะประตูชีวิต เราก็ควรอ้าแขนที่จะรับมัน เพราะเราไม่รู้ว่าเราจะมีโอกาสนั้นอีกครั้งหรือเปล่า อ้าแขนกว้างๆ แล้วทำมันให้ดีที่สุด ระหว่างทางอาจจะมีอุปสรรคบ้าง จงเชื่อตัวเอง แล้วฝ่ามันไป</p><p>มีคำหนึ่งคำที่ผมเชื่อมาเสมอ คือ</p><blockquote>ไม่มีใครไม่เคยพลาด เราต้องเรียนรู้จากความผิดพลาดนั้น</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d21c89969bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Don’t Give up]]></title>
            <link>https://medium.com/@ohmrefresh/%E0%B8%A1%E0%B8%B5%E0%B9%84%E0%B8%AB%E0%B8%A1-%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%9A%E0%B8%B2%E0%B8%87%E0%B8%84%E0%B8%A3%E0%B8%B1%E0%B9%89%E0%B8%87%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B9%80%E0%B8%88%E0%B8%AD%E0%B8%9B%E0%B8%B1%E0%B8%8D%E0%B8%AB%E0%B8%B2-%E0%B9%81%E0%B8%A5%E0%B9%89%E0%B8%A7%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B9%80%E0%B8%81%E0%B8%B4%E0%B8%94%E0%B8%96%E0%B8%AD%E0%B8%94%E0%B9%83%E0%B8%88-%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B8%88%E0%B8%B0%E0%B9%80%E0%B8%A5%E0%B8%B4%E0%B8%81%E0%B8%AA%E0%B8%B9%E0%B9%89-%E0%B8%AB%E0%B8%A3%E0%B8%B7%E0%B8%AD%E0%B9%80%E0%B8%A5%E0%B8%B4%E0%B8%81%E0%B8%97%E0%B8%B3%E0%B8%95%E0%B9%88%E0%B8%AD-%E0%B8%9A%E0%B8%B2%E0%B8%87%E0%B8%97%E0%B8%B5%E0%B8%96%E0%B9%89%E0%B8%B2%E0%B9%80%E0%B8%A3%E0%B8%B2%E0%B8%97%E0%B8%94%E0%B8%97%E0%B8%99%E0%B8%81%E0%B8%B1%E0%B8%94%E0%B8%9F%E0%B8%B1%E0%B8%99%E0%B8%AA%E0%B8%B9%E0%B9%89-162d5e5a4c51?source=rss-490d3e1f0069------2</link>
            <guid isPermaLink="false">https://medium.com/p/162d5e5a4c51</guid>
            <dc:creator><![CDATA[Authapon Kongkaew]]></dc:creator>
            <pubDate>Sun, 20 Nov 2016 09:04:50 GMT</pubDate>
            <atom:updated>2016-11-20T09:06:37.238Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Don’t Give up</strong></p><p>มีไหม ที่บางครั้งเราเจอปัญหา แล้วเราเกิดถอดใจ ที่จะเลิกสู้ หรือเลิกทำต่อ บางทีถ้าเราทดทนกัดฟันสู้อีกสักหน่อย วิธีแก้ปัญหาอาจจะอยู่อีกไม่ไกล กว่าที่เราคิด</p><blockquote>ที่มาของเรื่องนี้คือ ผมเขียน code แล้วติดปัญหา และไม่สามารถถามใครได้ ตอนแรกเกือบถอดใจแล้ว กัดฟันสู้อีกหน่อย สุดท้ายก็สามารถแก้ปัญหานั้นได้</blockquote><p>Solution ของผมเพื่อไม่ให้เกิดการท้อ</p><ul><li>กำหนด time box ให้กับตัวเอง หากติดปัญหา 10 นาทีแล้วแก้ไม่ได้ ถ้ามีคนให้ถาม ก็จงถาม แต่ถ้าไม่มีลองคุยกับคนข้างๆ เพื่อเค้าอาจจะเคยเจอปัญหาแบบเรา. สุดท้ายถ้าไม่ได้จริง ลุกขึ้นเดินออกไปดูนู้นี้นั้น แล้วกลับมาทำต่อ</li><li>หาอะไรที่ง่ายกว่ามาทำก่อน แล้วทำให้เสร็จ เพื่อให้เรามีกำลังใจ อย่างน้อยเราก็ทำได้</li></ul><blockquote>Don’t give up</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=162d5e5a4c51" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>