{"id":39016,"date":"2019-10-31T22:27:21","date_gmt":"2019-10-31T19:27:21","guid":{"rendered":"https:\/\/prohoster.info\/blog\/7-luchshih-praktik-po-ekspluatatsii-kontejnerov-po-versii-google\/"},"modified":"2019-10-31T22:27:21","modified_gmt":"2019-10-31T19:27:21","slug":"7-luchshih-praktik-po-ekspluatatsii-kontejnerov-po-versii-google","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sv\/blog\/administrirovanie\/7-luchshih-praktik-po-ekspluatatsii-kontejnerov-po-versii-google","title":{"rendered":"7 b\u00e4sta praxis f\u00f6r containerhantering enligt Google","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<p><i><b>Obs. \u00f6vers.<\/b>: F\u00f6rfattaren till den ursprungliga artikeln \u00e4r Th\u00e9o Chamley, arkitekt f\u00f6r molnl\u00f6sningar p\u00e5 Google. I denna publikation f\u00f6r Google Clouds blogg presenterade han en kort sammanfattning av en mer detaljerad guide fr\u00e5n hans f\u00f6retag, kallad \"<noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/solutions\/best-practices-for-operating-containers\">Best Practices for Operating Containers<\/a><\/noindex>\u00bb. I den har Googles experter sammanst\u00e4llt b\u00e4sta praxis f\u00f6r drift av containrar i samband med anv\u00e4ndningen av Google Kubernetes Engine och mer, ber\u00f6rande ett brett spektrum av \u00e4mnen: fr\u00e5n s\u00e4kerhet till \u00f6vervakning och loggning. S\u00e5, vilka metoder anser Google vara de viktigaste f\u00f6r arbete med containrar?<\/i><\/p>\n<p><img decoding=\"async\" alt=\"7 b\u00e4sta praxis f\u00f6r containerhantering enligt Google\" src=\"\/wp-content\/uploads\/2019\/10\/43aaa13a0fae1564ffc7f0a1fe0020b7.jpg\" style=\"display:block;margin: 0 auto;\" \/><noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<p><noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/kubernetes-engine\/\">Kubernetes Engine<\/a><\/noindex> <i>(Kubernetes-baserad tj\u00e4nst f\u00f6r att k\u00f6ra containeriserade till\u00e4mpningar i Google Cloud \u2014 <b>anm. \u00f6vers.<\/b>)<\/i> \u2014 \u00e4r ett av de b\u00e4sta s\u00e4tten att k\u00f6ra arbetsbelastningar som kr\u00e4ver skalning. <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/kubernetes\/\">Kubernetes<\/a><\/noindex> Det kommer att s\u00e4kerst\u00e4lla smidig funktion av de flesta applikationer, f\u00f6rutsatt att de \u00e4r containeriserade. Men om du vill att applikationen ska vara l\u00e4tt att hantera och vill dra nytta av alla f\u00f6rdelar med Kubernetes, m\u00e5ste du f\u00f6lja b\u00e4sta praxis. Dessa kommer att f\u00f6renkla driften av applikationen, dess \u00f6vervakning och fels\u00f6kning, samt \u00f6ka s\u00e4kerheten.<\/p>\n<p>I denna artikel kommer vi att g\u00e5 igenom vad man b\u00f6r veta och g\u00f6ra f\u00f6r att s\u00e4kerst\u00e4lla effektiv funktion av containrar i Kubernetes. F\u00f6r den som vill f\u00f6rdjupa sig i detaljerna rekommenderar vi att l\u00e4sa materialet <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/solutions\/best-practices-for-operating-containers\">Best Practices for Operating Containers<\/a><\/noindex>, samt ta en titt p\u00e5 v\u00e5rt <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/blog\/products\/gcp\/7-best-practices-for-building-containers\">tidigare inl\u00e4gg<\/a><\/noindex> om container-byggande.<\/p>\n<h2>1. Anv\u00e4nd inbyggda mekanismer f\u00f6r containrar f\u00f6r loggning<\/h2>\n<p>\nOm applikationen k\u00f6rs i en Kubernetes-kluster, beh\u00f6vs det inte s\u00e5 mycket f\u00f6r loggarna. Ett centralt loggningssystem \u00e4r troligtvis redan inbyggt i den anv\u00e4nda klustern. Vid anv\u00e4ndning av Kubernetes Engine ansvarar <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/logging\/\">Stackdriver Logging<\/a><\/noindex>. <i>(<b>Obs. \u00f6vers.<\/b>: Och vid anv\u00e4ndning av en egen installation av Kubernetes rekommenderar vi att du kollar in v\u00e5r Open Source-l\u00f6sning \u2014 <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/flant\/loghouse\">loghouse<\/a><\/noindex>.)<\/i> Komplikera inte ditt liv och anv\u00e4nd inbyggda mekanismer f\u00f6r loggning av containrar. Skriv loggar till stdout och stderr \u2014 de kommer automatiskt att h\u00e4mtas, sparas och indexeras.<\/p>\n<p>Om du vill kan du ocks\u00e5 skriva loggar till <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/logging\/docs\/structured-logging\">JSON-format.<\/a><\/noindex>. Denna metod g\u00f6r det enkelt att l\u00e4gga till metadata. Och tillsammans med dem kommer Stackdriver Logging att m\u00f6jligg\u00f6ra s\u00f6kning i loggarna med hj\u00e4lp av dessa metadata.<\/p>\n<h2>2. Se till att containrarna \u00e4r stateless och immutabla<\/h2>\n<p>\nF\u00f6r att containrar i ett Kubernetes-kluster ska fungera korrekt m\u00e5ste de vara stateless och immutable. N\u00e4r dessa villkor \u00e4r uppfyllda kan Kubernetes utf\u00f6ra sitt arbete genom att skapa och f\u00f6rst\u00f6ra applikationsenheter n\u00e4r och d\u00e4r det beh\u00f6vs.<\/p>\n<p><i>Stateless<\/i> betyder att allt tillst\u00e5nd (permanenta data av n\u00e5got slag) lagras utanf\u00f6r containern. F\u00f6r detta \u00e4ndam\u00e5l kan olika typer av externa lagringsl\u00f6sningar anv\u00e4ndas beroende p\u00e5 behov: <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/storage\/docs\">Cloud Storage<\/a><\/noindex>, <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/kubernetes-engine\/docs\/how-to\/stateful-apps\">Persistent Disks<\/a><\/noindex>, <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/memorystore\/docs\/redis\/\">Redis<\/a><\/noindex>, <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/sql\/docs\/\">Cloud SQL<\/a><\/noindex> eller andra hanterade databaser. <i>(<b>Obs. \u00f6vers.<\/b>: L\u00e4s mer om detta i v\u00e5r artikel \"<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/326414\/\">Operat\u00f6rer f\u00f6r Kubernetes: hur man k\u00f6r stateful-applikationer<\/a><\/noindex>\u00bb.)<\/i><\/p>\n<p><i>Immutable<\/i> betyder att containern inte kommer att modifieras under sin livsl\u00e4ngd: inga uppdateringar, patchar eller \u00e4ndringar i konfigurationen. Om du beh\u00f6ver uppdatera applikationens kod eller applicera en patch, skapa en ny bild och distribuera den. Det rekommenderas att flytta containerns konfiguration (port f\u00f6r lyssning, k\u00f6rmilj\u00f6alternativ, osv.) utanf\u00f6r \u2014 till <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/configuration\/secret\/\">Secrets<\/a><\/noindex> och <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/tasks\/configure-pod-container\/configure-pod-configmap\/\">ConfigMaps<\/a><\/noindex>. Dessa kan uppdateras utan att beh\u00f6va bygga en ny containerbild. F\u00f6r att enkelt skapa pipeline f\u00f6r bildbyggande kan man anv\u00e4nda <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/cloud-build\/\">Cloud Build<\/a><\/noindex>. <i>(<b>Obs. \u00f6vers.<\/b>: Vi anv\u00e4nder ett Open Source-verktyg f\u00f6r dessa \u00e4ndam\u00e5l <noindex><a rel=\"nofollow\" href=\"https:\/\/github.com\/flant\/dapp\">dapp<\/a><\/noindex>.)<\/i><\/p>\n<p><img decoding=\"async\" alt=\"7 b\u00e4sta praxis f\u00f6r containerhantering enligt Google\" src=\"\/wp-content\/uploads\/2019\/10\/f13a83d22e7b8d7c1e8ac6a63c35646c.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>Exempel p\u00e5 att uppdatera en Deployment-konfiguration i Kubernetes med hj\u00e4lp av en ConfigMap som \u00e4r monterad i pods som konfiguration<\/i><\/p>\n<h2>3. Undvik privilegierade containrar<\/h2>\n<p>\n\u0412\u044b \u0432\u0435\u0434\u044c \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434 root&#8217;\u043e\u043c \u043d\u0430 \u0441\u0432\u043e\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445, \u0432\u0435\u0440\u043d\u043e? \u0415\u0441\u043b\u0438 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u043f\u0440\u043e\u043d\u0438\u043a\u043d\u0435\u0442 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 root. \u0422\u0435 \u0436\u0435 \u0441\u043e\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u044b \u0438 \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b. \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043d\u0430 \u0445\u043e\u0441\u0442\u0435, \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0443 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0435 <i>capabilities<\/i> med alternativet <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/tasks\/configure-pod-container\/security-context\/#set-capabilities-for-a-container\"><code>securityContext<\/code><\/a><\/noindex> i Kubernetes. Om det kr\u00e4vs att \u00e4ndra <i>sysctls<\/i>, har Kubernetes en <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/tasks\/administer-cluster\/sysctl-cluster\/\">separat annotation<\/a><\/noindex> f\u00f6r detta. \u00d6verlag, f\u00f6rs\u00f6k att maximalt utnyttja <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/init-containers\/\">init-<\/a><\/noindex> och sidecar-containrar f\u00f6r att utf\u00f6ra s\u00e5dana privilegierade operationer. De beh\u00f6ver inte vara tillg\u00e4ngliga f\u00f6r varken intern eller extern trafik.<\/p>\n<p>Om du administrerar en kluster kan du anv\u00e4nda <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/concepts\/policy\/pod-security-policy\/#privileged\">Pod Security Policy<\/a><\/noindex> f\u00f6r begr\u00e4nsningar i till\u00e4mpningen av privilegierade containrar.<\/p>\n<h2>4. Undvik att k\u00f6ra som root<\/h2>\n<p>\n\u041e \u043f\u0440\u0438\u0432\u0438\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430\u0445 \u0443\u0436\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043e, \u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435, \u0435\u0441\u043b\u0438 \u0432 \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a \u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u0442\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u043e\u0434 root&#8217;\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430. \u0415\u0441\u043b\u0438 \u0437\u043b\u043e\u0443\u043c\u044b\u0448\u043b\u0435\u043d\u043d\u0438\u043a \u043d\u0430\u0439\u0434\u0451\u0442 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0441 \u043f\u0440\u0430\u0432\u0430\u043c\u0438 root \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u0443\u044e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0439\u0442\u0438 \u0438\u0437 \u043f\u0440\u0435\u0434\u0435\u043b\u043e\u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u043a\u0430 \u0435\u0449\u0451 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0443\u044e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442 root&#8217;\u0430 \u043d\u0430 \u0445\u043e\u0441\u0442\u0435.<\/p>\n<p>\u041b\u0443\u0447\u0448\u0438\u0439 \u043f\u0443\u0442\u044c \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u044d\u0442\u043e\u0433\u043e \u2014 \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u043f\u043e\u0434 root&#8217;\u043e\u043c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u043e\u0439 <code>USER<\/code> p\u00e5 <code>Dockerfile<\/code> eller <code>runAsUser<\/code> i Kubernetes. Klusteradministrat\u00f6ren kan ocks\u00e5 konfigurera tv\u00e5ngsbeteende med hj\u00e4lp av <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/kubernetes-engine\/docs\/how-to\/pod-security-policies\">Pod Security Policy<\/a><\/noindex>.<\/p>\n<h2>5. G\u00f6r applikationen l\u00e4tt \u00f6vervakad<\/h2>\n<p>\nPrecis som loggning \u00e4r \u00f6vervakning en oumb\u00e4rlig del av applikationshantering. En popul\u00e4r l\u00f6sning f\u00f6r \u00f6vervakning i Kubernetes-gemenskapen \u00e4r <noindex><a rel=\"nofollow\" href=\"https:\/\/prometheus.io\/\">Prometheus<\/a><\/noindex> \u2014 ett system som automatiskt uppt\u00e4cker pods och tj\u00e4nster som beh\u00f6ver \u00f6vervakas. <i>(<b>Obs. \u00f6vers.<\/b>: Se \u00e4ven v\u00e5r <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/412901\/\">detaljerade rapport<\/a><\/noindex> om \u00e4mnet \u00f6vervakning med Prometheus och Kubernetes.)<\/i> <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/monitoring\/kubernetes-engine\/\">Stackdriver<\/a><\/noindex> kan \u00f6vervaka Kubernetes-kluster och inkluderar sin egen version av Prometheus f\u00f6r applikations\u00f6vervakning.<\/p>\n<p><img decoding=\"async\" alt=\"7 b\u00e4sta praxis f\u00f6r containerhantering enligt Google\" src=\"\/wp-content\/uploads\/2019\/10\/642b9ccc4b7a789018a4aeeb62e7cae7.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<i>Kubernetes \u00f6vervakningspanel i Stackdriver<\/i><\/p>\n<p>Prometheus f\u00f6rv\u00e4ntar sig att applikationen exponerar metrik p\u00e5 en HTTP-endpoint. F\u00f6r detta finns tillg\u00e4ngliga <noindex><a rel=\"nofollow\" href=\"https:\/\/prometheus.io\/docs\/instrumenting\/clientlibs\/\">Prometheus klientbibliotek<\/a><\/noindex>. Ett liknande format anv\u00e4nds av andra verktyg som <noindex><a rel=\"nofollow\" href=\"http:\/\/opencensus.io\/\">OpenCensus<\/a><\/noindex> och <noindex><a rel=\"nofollow\" href=\"https:\/\/istio.io\/\">Istio<\/a><\/noindex>.<\/p>\n<h2>6. G\u00f6r applikationens h\u00e4lsotillst\u00e5nd tillg\u00e4ngligt<\/h2>\n<p>\nHantera en applikation i produktion underl\u00e4ttas av dess f\u00f6rm\u00e5ga att rapportera sitt tillst\u00e5nd till hela systemet. \u00c4r applikationen ig\u00e5ng? \u00c4r den i ordning? \u00c4r den redo att ta emot trafik? Hur beter den sig? Den vanligaste l\u00f6sningen f\u00f6r detta problem \u00e4r att implementera h\u00e4lsokontroller <i>(health checks)<\/i>. Kubernetes har tv\u00e5 typer av dessa: <noindex><a rel=\"nofollow\" href=\"https:\/\/kubernetes.io\/docs\/tasks\/configure-pod-container\/configure-liveness-readiness-probes\/\">liveness och readiness probes<\/a><\/noindex>.<\/p>\n<p>F\u00f6r liveness probe <i>(livsr\u00e4knare)<\/i> m\u00e5ste applikationen ha en HTTP-endpoint som returnerar svaret '200 OK' om den fungerar och dess grundl\u00e4ggande beroenden \u00e4r tillfredsst\u00e4llda. F\u00f6r readiness probe <i>(beredskapskontroll)<\/i> \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 HTTP endpoint, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 \u043e\u0442\u0432\u0435\u0442 \u00ab200 OK\u00bb, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0437\u0434\u043e\u0440\u043e\u0432\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438, \u0448\u0430\u0433\u0438 \u043f\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u044b \u0438 \u043b\u044e\u0431\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043e\u0448\u0438\u0431\u043a\u0435. Kubernetes \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0440\u0430\u0444\u0438\u043a \u043d\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u044d\u0442\u0438\u043c\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438. \u0414\u0432\u0430 endpoint&#8217;\u0430 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u044b, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f\u043c\u0438 \u0436\u0438\u0437\u043d\u0435\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 (liveness) \u0438 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 (readiness) \u043d\u0435\u0442.<\/p>\n<p>Mer om detta kan l\u00e4sas i den relevanta artikeln av Sandeep Dinesh, Developer Advocate fr\u00e5n Google: \"<noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/blog\/products\/gcp\/kubernetes-best-practices-setting-up-health-checks-with-readiness-and-liveness-probes\">Kubernetes b\u00e4sta metoder: St\u00e4lla in h\u00e4lsokontroller med beredskaps- och livbarhetsprober<\/a><\/noindex>\u00bb.<\/p>\n<h2>7. Var noga med att v\u00e4lja r\u00e4tt bildversion<\/h2>\n<p>\nDe flesta offentliga och privata bilder anv\u00e4nder ett taggningssystem som liknar det som beskrivs i <noindex><a rel=\"nofollow\" href=\"https:\/\/cloud.google.com\/solutions\/best-practices-for-building-containers#properly_tag_your_images\">Best Practices for Building Containers<\/a><\/noindex>. Om bilden till\u00e4mpar ett system som liknar <noindex><a rel=\"nofollow\" href=\"https:\/\/semver.org\/lang\/ru\/\">semantisk versionering<\/a><\/noindex>, m\u00e5ste man ta h\u00e4nsyn till specifiken i taggningen. Till exempel kan taggen <code>latest<\/code> ofta flyttas fr\u00e5n bild till bild - man kan inte f\u00f6rlita sig p\u00e5 den om man beh\u00f6ver f\u00f6ruts\u00e4gbara och reproducerbara byggnader och installationer.<\/p>\n<p>Du kan anv\u00e4nda taggen <code>X.Y.Z<\/code> (de \u00e4r n\u00e4stan alltid of\u00f6r\u00e4ndrade), men i s\u00e5 fall, h\u00e5ll koll p\u00e5 alla patchar och uppdateringar av bilden. Om den anv\u00e4nda bilden har taggen <code>X.Y<\/code>, \u00e4r det ett bra kompromissalternativ. Genom att v\u00e4lja det f\u00e5r du automatiskt patchar och f\u00f6rlitar dig samtidigt p\u00e5 en stabil version av applikationen.<\/p>\n<h2>P.S. fr\u00e5n \u00f6vers\u00e4ttaren<\/h2>\n<p>\nL\u00e4s \u00e4ven i v\u00e5r blogg:<\/p>\n<ul>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/422949\/\">Ny statistik fr\u00e5n CNCF om containrar, cloud native och Kubernetes<\/a><\/noindex>\u00bb;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/353272\/\">7 principer f\u00f6r design av containerbaserade applikationer<\/a><\/noindex>\u00bb;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/417905\/\">11 s\u00e4tt att (inte) bli offer f\u00f6r hackning i Kubernetes<\/a><\/noindex>\u00bb;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/331188\/\">V\u00e5r erfarenhet med Kubernetes i sm\u00e5 projekt<\/a><\/noindex>\u00bb <i>(\u00f6versikt och video av presentationen)<\/i>;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/412901\/\">\u00d6vervakning och Kubernetes<\/a><\/noindex>\u00bb <i>(\u00f6versikt och video av presentationen)<\/i>;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/324274\/\">Vi samlar Docker-bilder f\u00f6r CI\/CD snabbt och enkelt med dapp<\/a><\/noindex>\u00bb <i>(\u00f6versikt och video av presentationen)<\/i>;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/322686\/\">Praktiker f\u00f6r Continuous Delivery med Docker<\/a><\/noindex>\u00bb <i>(\u00f6versikt och video av presentationen)<\/i>;<\/li>\n<li> \u00ab<noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/company\/flant\/blog\/347518\/\">D\u00f6den av mikrotj\u00e4nsternas galenskap \u00e5r 2018.<\/a><\/noindex>\u00bb.<\/li>\n<\/ul>\n<p>K\u00e4lla: <a content=\"nofollow\" rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/company\/flant\/blog\/425085\/\">habr.com<\/a><\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.: \u0410\u0432\u0442\u043e\u0440 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 Th\u00e9o Chamley, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 Google. \u0412 \u044d\u0442\u043e\u0439 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u0431\u043b\u043e\u0433\u0430 Google Cloud \u043e\u043d \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u043b \u043a\u0440\u0430\u0442\u043a\u0443\u044e \u0432\u044b\u0436\u0438\u043c\u043a\u0443 \u0438\u0437 \u0431\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u0430 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438, \u043d\u0430\u0437\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u00abBest Practices for Operating Containers\u00bb. \u0412 \u043d\u0451\u043c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b Google \u0441\u043e\u0431\u0440\u0430\u043b\u0438 \u043b\u0443\u0447\u0448\u0438\u0435 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0438 \u043f\u043e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Google Kubernetes Engine \u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e, \u0437\u0430\u0442\u0440\u043e\u043d\u0443\u0432 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":29273,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-39016","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.4 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.: \u0410\u0432\u0442\u043e\u0440 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 Th\u00e9o Chamley, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 Google.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sv\/blog\/administrirovanie\/7-luchshih-praktik-po-ekspluatatsii-kontejnerov-po-versii-google\" \/>\n\t\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.4\" \/>\n\t\t<meta property=\"og:locale\" content=\"sv_SE\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd477 \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u043f\u043e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043f\u043e \u0432\u0435\u0440\u0441\u0438\u0438 Google | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.: \u0410\u0432\u0442\u043e\u0440 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 Th\u00e9o Chamley, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 Google.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sv\/blog\/administrirovanie\/7-luchshih-praktik-po-ekspluatatsii-kontejnerov-po-versii-google\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T19:27:21+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T19:27:21+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd477 b\u00e4sta metoder f\u00f6r containeranv\u00e4ndning enligt Google | ProHoster","description":"Obs. \u00f6vers.: F\u00f6rfattaren av den ursprungliga artikeln \u00e4r Th\u00e9o Chamley, arkitekt f\u00f6r molnl\u00f6sningar vid Google.","canonical_url":"https:\/\/prohoster.info\/sv\/blog\/administrirovanie\/7-luchshih-praktik-po-ekspluatatsii-kontejnerov-po-versii-google","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sv_SE","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd477 \u043b\u0443\u0447\u0448\u0438\u0445 \u043f\u0440\u0430\u043a\u0442\u0438\u043a \u043f\u043e \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043f\u043e \u0432\u0435\u0440\u0441\u0438\u0438 Google | ProHoster","og:description":"\u041f\u0440\u0438\u043c. \u043f\u0435\u0440\u0435\u0432.: \u0410\u0432\u0442\u043e\u0440 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 Th\u00e9o Chamley, \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u043e\u0440 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439 Google.","og:url":"https:\/\/prohoster.info\/sv\/blog\/administrirovanie\/7-luchshih-praktik-po-ekspluatatsii-kontejnerov-po-versii-google","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T19:27:21+00:00","article:modified_time":"2019-10-31T19:27:21+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"39016","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-24 00:24:24","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 00:58:39","updated":"2026-01-24 00:24:24","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/posts\/39016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/comments?post=39016"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/posts\/39016\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/media\/29273"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/media?parent=39016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/categories?post=39016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sv\/wp-json\/wp\/v2\/tags?post=39016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}