kubectl apply の仕組み / How kubectl apply works

kubectl apply の仕組み / How kubectl apply works

Kubernetes Meetup Tokyo #5
2017.06.27
https://k8sjp.connpass.com/event/56945/

365dfdeb6858bb8b82baedb582bfe1cf?s=128

Takashi Kusumi

June 26, 2017
Tweet

Transcript

  1. LVCFDUMBQQMZך➬穈׫ 5BLBTIJ,VTVNJ ;-BC

  2. LVCFDUMBQQMZהכ Ӝ ؔـآؙؑزָ㶷㖈׃זֽ׸ל⡲䧭 1045 ծ㶷㖈ׅ׸ל䊴ⴓ 1"5$) ׾⿾僥׃גֻ׸׷⤑ⵃז؟ـ؝وٝس وصؿؑأزח״׷㹑鎉涸 EFDMBSBUJWF ז盖椚ָ〳腉

    Ӝ ⽃秪ז♳剅ֹדכזֻծ䊴ⴓ⿾僥ד֮׷ֿהח岣䠐 LVCFDUMSFQMBDFכ⽃秪ז♳剅ֹ 165  Ӝ 䊴ⴓכLVCFDUM⩎ד鎘皾ׁ׸׷ 
  3. ➭ך؟ـ؝وٝسהך麩ְ  ؟ـ؝وٝس ؔـآؙؑزָ㶷㖈׃זְ ؔـآؙؑزָ㶷㖈ׅ׷ BQQMZ 倜鋉⡲䧭 1045 䊴ⴓ⿾僥 1"5$)

    ˟ DSFBUF 倜鋉⡲䧭 1045 ⚠ؒٓ٦ SFQMBDF ⚠ؒٓ٦ ♳剅ֹ 165 QBUDI ⚠ؒٓ٦ 䊴ⴓ⿾僥 1"5$) EFMFUF ⚠ؒٓ٦ ⵴ꤐ %&-&5& ˟QSVOF׾⢪׏׋㜥さ%&-&5&׮֮׶䖤׷
  4. 㹑鎉涸 EFDMBSBUJWF ؔـآؙؑز盖椚 Ӝ BQQMZח״׶وصؿؑأز纇 㹑鎉 ׌ֽח״׷盖椚ָדֹ׷ Ӝ ؔـآؙؑزך⿾僥כLVCFDUMBQQMZGDPOH׌ֽ Ӝ

    QSVOF׾⢪ִל⵴ꤐ׮荈⹛ד遤ִ׷ BMQIB堣腉  Ӝ 鑫稢כⰕ䒭سًُؗٝز׾⿫撑 ,VCFSOFUFT0CKFDU.BOBHFNFOU  ZBNM
  5. BQQMZך䊴ⴓ⿾僥

  6. ㉏겗ٖفٔؕ侧כוֲז׷   apiVersion: extensions/v1beta1 kind: Deployment metadata: name: myapp1

    spec: # レプリカ数を指定しない template: metadata: labels: run: myapp1 spec: containers: - image: nginx name: myapp1
  7. ㉏겗ٖفٔؕ侧כוֲז׷  Ӝ ٖفٔؕ侧׾䭷㹀ׇ׆EFQMPZNFOU׾BQQMZׅ׷ LVCFDUMBQQMZGNZBQQEFQZBNM Ӝ TDBMF؝وٝسדؔـآؙؑزךٖفٔؕ侧׾ח㢌刿 LVCFDUMTDBMFSFQMJDBTEFQMPZNZBQQ Ӝ ずׄوصؿؑأز׾ⱄ䏝BQQMZׅ׷

    LVCFDUMBQQMZGNZBQQEFQZBNM 
  8. 瘶ִٖفٔؕ侧כךתתחז׷

  9. ㉏겗ٖفٔؕ侧כוֲז׷   apiVersion: extensions/v1beta1 kind: Deployment metadata: name: myapp2

    spec: replicas: 3 # レプリカ数を指定 template: metadata: labels: run: myapp2 spec: containers: - image: nginx name: myapp2
  10. ㉏겗ٖفٔؕ侧כוֲז׷  Ӝ ٖفٔؕ侧׾ח䭷㹀׃׋EFQMPZNFOU׾BQQMZׅ׷ LVCFDUMBQQMZGNZBQQEFQZBNM Ӝ TDBMF؝وٝسדؔـآؙؑزךٖفٔؕ侧׾ח㢌刿 LVCFDUMTDBMFSFQMJDBTEFQMPZNZBQQ Ӝ وصؿؑأزַ׵ٖفٔؕ侧ך鎸鶢׾չ⵴ꤐպ׃גBQQMZׅ׷

    LVCFDUMBQQMZGNZBQQEFQZBNM չEFQMPZNFOUTQFDSFQMJDBTպ荈⡤ך鎸鶢׾⵴ꤐ 
  11. 瘶ִٖفٔؕ侧כחז׷

  12. 䊴ⴓ鎘皾  ⵴ꤐⴓך鎘皾 ➙㔐ךوصؿؑأزה⵸㔐BQQMZ׃׋وصؿؑأز׾嫰鯰׃ג ⵴ꤐׁ׸׋ؿ؍٦ٕس׾鎘皾ׅ׷ ⵸㔐ⴓכMBTUBQQMJFEDPOHVSBUJPOהְֲ،ظذ٦ءّٝח ⥂㶷ׁ׸גְ׷  鷄⸇٥㢌刿ⴓך鎘皾 

    ➙㔐ךوصؿؑأزה植㖈ךؔـآؙؑز׾嫰鯰׃ג鷄⸇٥㢌 刿ⴓ׾鎘皾ׅ׷ 
  13. ػحثה׃ג鷏⥋ׁ׸׷  { "metadata": { "annotations": { "kubectl.kubernetes.io/last-applied-configuration": "..." }

    }, "spec": { "replicas": null } } curl -XPATCH -H "Content-Type: application/strategic-merge-patch+json" ... https://.../apis/extensions/v1beta1/namespaces/default/deployments/myapp https://github.com/kubernetes/community/blob/master/contributors/devel/strategic-merge-patch.md
  14. ֿך➬穈׫ח״׷ًٔحز Ӝ وصؿؑأزח剅ַ׸גְזְؿ؍٦ٕسכ⥂䭯ׁ׸ג刿倜 )PSJ[POUBM1PE"VUPTDBMFSך״ֲז➬穈׫ה湱䚍ָ葺ְ Ӝ وصؿؑأزַ׵չ⵴ꤐպ׃׋הְֲ䞔㜠׾⿾僥ׇׁ׵׸׷ Ӝ ⵸鶢ך㉏겗כ剑ⴱַ׵ٖفٔؕ侧׾剅ַזֽ׸לծLVCFDUM TDBMFד㢌刿׃׋⦼ךתת⥂䭯ׁ׸׷ 

  15. תה׭ Ӝ BQQMZכ♳剅ֹדכזֻ䊴ⴓ⿾僥 Ӝ 䊴ⴓ鎘皾כչ⵴ꤐⴓպהչ鷄⸇٥㢌刿ⴓպד嫰鯰㼎韋ָ殯ז׷ ⵸㔐ךوصؿؑأزָ،ظذ٦ءّٝה׃ג⥂㶷ׁ׸גְ׷ Ӝ 鑫׃ֻכ⟃♴ךⰕ䒭سًُؗٝز׾⿫撑 %FDMBSBUJWF.BOBHFNFOUPG,VCFSOFUFT0CKFDUT6TJOH $POHVSBUJPO'JMFT

    
  16. 8FBSFIJSJOH CJUMZ[MBCDBSFFST