Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CoreOS Fest 2017 Recap

CoreOS Fest 2017 Recap

Kubernetes Meetup Tokyo #5 / 2017.06.27
Kazuki Suda @superbrothers, Tomoya Usami @hiyosi
https://k8sjp.connpass.com/event/56945/

Kazuki Suda

June 27, 2017
Tweet

More Decks by Kazuki Suda

Other Decks in Technology

Transcript

  1. 8IBUJT$PSF04'FTU Ӝ FUDE $POUBJOFS-JOVY׾Ꟛ涪ׅ׷$PSF04 *ODךؕٝؿ؋ٖٝأ Ӝ ⚺ח$PSF04 *ODָꟚ涪ׅ׷اؿزؐؑ،װꟼ鸬䪮遭ָ䪔׻׸׷ ,VCFSOFUFT FUDE

    $POUBJOFS-JOVY 5FDUPOJD FUD $PSF04 *ODה♧筰חؽآطأ׃גְ׷⟰噟ך✲⢽稱➜׮ Ӝ ➙䎃䎃כ ך✳傈꟦؟ٝؿٓٝءأ؝דꟚ⪵ ׍ז׫ח䎃כس؎خكٕٔٝ 
  2. 01"0QFO1PMJDZ"HFOU Ӝ ؖغشٝأٗآحؙ׾،فٔ؛٦ءّٝٗآحַؙ׵ⴓꨄ Ӝ هٔء٦׾㹑鎉涸ז鎉铂ד鎸鶢 3FHP  Ӝ +40/ת׋כ:".- Ӝ

    3&45"1*T Ӝ (P鎉铂ד㹋鄲 ر٦ٌٝծٓ؎ـٓٔծ3&1-  Ӝ "QBDIFٓ؎إٝأ Ӝ IUUQXXXPQFOQPMJDZBHFOUPSH 
  3.  package admission.blacklist reason["must pin image(s) to specific version in

    production namespace"] { input.spec.namespace = "production" unpinned_tag } unpinned_tag = true { image_names[name] not re_match(pinned_version_pattern, name) } unpinned_tag = true { image_names[name] endswith(name, ":latest") } image_names[name] { name = input.spec.object.Spec.Template.Spec.Containers[_].Image } image_names[name] { name = input.spec.object.Spec.Containers[_].Image } pinned_version_pattern = ".+:.+"
  4. 

  5. Ӝ %BO8JMTPO 1SJODJQBM"SDIJUFDU $PODVS Ӝ GFEFSBUJPO4VQQPSUDSFBUJOHSFTPVSDFTJOTQFDJDDMVTUFST  Ӝ WTVQQPSUFEPCKFDUT $POHNBQ

    4FDSFU %BFNPOTFU 4FSWJDFT *OHSFTT 
 3FQMJDBTFU %FQMPZNFOU ,VCFSOFUFT'FEFSBUFE$MVTUFS4FMFDUPS 
  6. GFEFSBUJPOBMQIBLVCFSOFUFTJPDMVTUFSTFMFDUPS  apiVersion: extensions/v1beta1 kind: Ingress metadata: name: test annotations:

    federation.alpha.kubernetes.io/cluster-selector: [{"key": "cluster", "operator": "==", "values": ["cluster1"]}] spec: rules: - host: foo.bar.com http: paths: - path: /foo backend: serviceName: s1 servicePort: 80 - path: /bar backend: serviceName: s2 servicePort: 80
  7. Ӝ $POUSPMMFS1BUUFSO 朐䡾׾ؐؓحث׃ג➙ך朐䡾׾劄׬朐䡾ח鵚בֽגְֻ  for { desired := getDesiredState() current

    := getCurrentState() makeChanges(desired, current) } 8SJUJOHB$VTUPN,VCFSOFUFT0QFSBUPS $POUSPMMFS
  8.  _, controller := cache.NewInformer( &cache.ListWatch{ // List should return

    a list type object ListFunc: func(lo metav1.ListOptions) (runtime.Object, error) { return client.Core().Nodes().List(lo) }, // Watch should return a watch Interface. begin a watch at the specified version. WatchFunc: func(lo metav1.ListOptions) (watch.Interface, error) { return client.Core().Nodes().Watch(lo) }, }, // The types of objects this informer will return &v1.Node{}, // The resync period of this object 10*time.Second, // the object you want notifications sent to cache.ResourceEventHandlerFuncs{ // AddFunc: func(obj interface{}) {} UpdateFunc: func(old, newObj interface{}) { … }, // DeleteFunc: func(obj interface{}) {} }, )
  9. &OEUPFOENPOJUPSJOHXJUIUIF1SPNFUIFVT0QFSBUPS Ӝ 'SFEFSJD#SBOD[ZL $PSF04 Ӝ 1SPNFUIFVT*OUSP Ӝ ,VCFSOFUFTDPNQPOFOUTFYQPTF1SPNFUIFVTNFUSJDT Ӝ 4FMGIPTUFE,VCFSOFUFT

    IUUQTDPSFPTDPNCMPHTFMGIPTUFELVCFSOFUFTIUNM Ӝ 1SPNFUIFVT0QFSBUPS IUUQTHJUIVCDPNDPSFPTQSPNFUIFVTPQFSBUPS 
  10. 1SPNFUIFVT0QFSBUPS apiVersion: monitoring.coreos.com/v1alpha1 kind: Prometheus metadata: name: k8s labels: prometheus:

    k8s spec: replicas: 2 version: v1.7.0 serviceAccountName: prometheus-k8s serviceMonitorSelector: matchExpressions: - {Key: k8s-app, operator: Exists} $ kubectl create -f prometheus-k8s.yaml prometheus "prometheus-k8s" created service "prometheus-k8s" created
  11. 4UBUFPG4UBUFJO$POUBJOFST Ӝ 4UBUFGVM4FU 1SPDFTT.BOBHFNFOU $POTJTU/BNJOH  TUBUFGVMTFUOBNF  PSEJOBM 

    1FSTJTUFOU4UPSBHF WPMVNF$MBJN5FNQMBUFBOE%ZOBNJD1SPWJTJPOJOH 1FFSEJTDPWFSZ )FBEMFTT4FSWJDF 
  12.