{"id":315929,"date":"2021-01-03T21:00:20","date_gmt":"2021-01-03T21:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=315929"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=315929","title":{"rendered":"\u0416\u0438\u0437\u043d\u044c .NET \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Kubernetes"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/kubernetes.io\/\" rel=\"noopener noreferrer nofollow\">Kubernetes<\/a><\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0430\u0441\u043f\u0435\u043a\u0442\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0436\u0438\u0432\u044b \u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0438 \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u043d\u0430\u043c, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043f\u043e\u043c\u043e\u0447\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes. \u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0435 Docker Desktop. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c Kubernetes \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9b5\/f68\/b1a\/9b5f68b1a7c1674afa6a3362a2050e3f.png\" width=\"1250\" height=\"720\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Docker Desktop \u0432 Windows 10 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/534504\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a><\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Web API<\/h2>\n<p>\u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 ASP.NET Core Web API<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a6b\/531\/20c\/a6b53120c9b61cfbe6feeda1020d8207.png\" alt=\"\u041d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c WebApiLiveness\" title=\"\u041d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c WebApiLiveness\" width=\"1024\" height=\"710\"><figcaption>\u041d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c WebApiLiveness<\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e \u0447\u0435\u0440\u0435\u0437 Package Manager \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>Install-Package Lorem.Universal.Net -Version 3.0.69<\/code><\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u044e \u0444\u0430\u0439\u043b <em>Program.cs<\/em><\/p>\n<pre><code class=\"cs\">using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using System;  namespace WebApiLiveness {     public class Program     {         private static int _port = 80;         private static TimeSpan _kaTimeout = TimeSpan.FromSeconds(1);          public static void Main(string[] args)         {             CreateAndRunHost(args);         }          public static void CreateAndRunHost(string[] args)         {             var host = Host                 .CreateDefaultBuilder(args)                 .ConfigureWebHostDefaults(webBuilder =&gt;                 {                     webBuilder                         .UseKestrel(options =&gt;                          {                             options.ListenAnyIP(_port);                             options.Limits.KeepAliveTimeout = _kaTimeout;                         })                         .UseStartup&lt;Startup&gt;();                 })                 .Build();              host.Run();         }     } }<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441 <em>LoremService<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/p>\n<pre><code class=\"cs\">using LoremNET;  namespace WebApiLiveness.Services {     public class LoremService     {         private int _wordCountMin = 7;         private int _wordCountMax = 12;          public string GetSentence()         {             var sentence = Lorem.Sentence(_wordCountMin, _wordCountMax);             return sentence;         }     } }<\/code><\/pre>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 <em>Startup<\/em> \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441<\/p>\n<pre><code class=\"cs\">public void ConfigureServices(IServiceCollection services) {     services.AddSingleton&lt;LoremService&gt;();     services.AddControllers(); }<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u043d\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043d\u0430 <em>LoremController<\/em><\/p>\n<pre><code class=\"cs\">using Microsoft.AspNetCore.Mvc; using System; using System.Net; using WebApiLiveness.Services; using Env = System.Environment;  namespace WebApiLiveness.Controllers {   [ApiController]   [Route(\"api\/[controller]\")]   public class LoremController : ControllerBase   {     private readonly LoremService _loremService;      public LoremController(LoremService loremService)     {         _loremService = loremService;     }      \/\/GET api\/lorem     [HttpGet]     public ActionResult&lt;string&gt; Get()     {       try       {           var localIp = Request.HttpContext.Connection.LocalIpAddress;           var loremText = _loremService.GetSentence();           var result =             $\"{Env.MachineName} ({localIp}){Env.NewLine}{loremText}\";           return result;       }       catch (Exception)       {           return new StatusCodeResult(             (int)HttpStatusCode.ServiceUnavailable);       }     }   } }<\/code><\/pre>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0444\u0430\u0439\u043b <em>Dockerfile<\/em> \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.  \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u0437\u044f\u0442 \u043e\u0431\u0440\u0430\u0437, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 ASP.NET \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 .NET 5<\/p>\n<pre><code>FROM mcr.microsoft.com\/dotnet\/aspnet:5.0-buster-slim COPY bin\/Release\/net5.0\/linux-x64\/publish\/ App\/ WORKDIR \/App ENTRYPOINT [\"dotnet\", \"WebApiLiveness.dll\"]<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a23\/dc9\/810\/a23dc98107b7285e61507e1c218a52cd.png\" alt=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\" title=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\" width=\"341\" height=\"351\"><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/figcaption><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430<\/h2>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u044e \u0440\u0435\u043b\u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <code>dotnet publish -c Release -r linux-x64<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/ef4\/548\/705\/ef4548705c644442fbdcc2062f83df30.png\" width=\"1304\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u043c \u043e\u0431\u0440\u0430\u0437, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Dockerfile. \u0412\u044b\u043f\u043e\u043b\u043d\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438\u0437 \u043f\u0430\u043f\u043a\u0438, \u0433\u0434\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b  <code>docker build -t sasha654\/webapiliveness .<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/d8e\/4f9\/de9\/d8e4f9de925bd0090b3b0413b8c0ab5d.png\" width=\"1252\" height=\"604\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044e \u043e\u0431\u0440\u0430\u0437 \u0432 <a href=\"https:\/\/hub.docker.com\/\" rel=\"noopener noreferrer nofollow\">Docker Hub<\/a> <code>docker push sasha654\/webapiliveness<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/c4f\/acb\/42a\/c4facb42aee7a263fd9175395641693c.png\" width=\"1252\" height=\"604\"><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u043e\u0431\u0440\u0430\u0437 \u0432 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432 \u0441\u0432\u043e\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 Docker Hub, \u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 <em>sasha654<\/em> \u0441\u0432\u043e\u0439 Docker ID, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9da\/827\/ba0\/9da827ba0d2bdd7f3995963b7f7e862c.png\" width=\"1252\" height=\"831\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes, \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044e, \u0447\u0442\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u0437\u0430\u043f\u0443\u0449\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 Docker <code>docker run -p 8080:80 -d sasha654\/webapiliveness<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9da\/6f6\/93f\/9da6f693f2a8056a19c65262d3f5a48b.png\" width=\"1252\" height=\"604\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044e \u0437\u0430\u043f\u0440\u043e\u0441 <code>curl http:\/\/localhost:8080\/api\/lorem<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6d5\/cee\/719\/6d5cee7193f3e6a9bf0c12a4c816cdd3.png\" width=\"1252\" height=\"604\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e \u0438 \u0443\u0434\u0430\u043b\u044e \u044d\u0442\u043e\u0442, \u0443\u0436\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0439, \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0f0\/8f6\/0f8\/0f08f60f89cc8e9cda1a1038fdc83802.png\" width=\"1252\" height=\"604\"><figcaption><\/figcaption><\/figure>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Kubernetes<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u0435\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/\" rel=\"noopener noreferrer nofollow\">Pod<\/a> \u2013 \u044d\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e (\u0447\u0430\u0449\u0435) \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 (\u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0440\u0435\u0436\u0435) \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 <\/p>\n<p>\u041f\u043e\u0434\u044b \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u0418 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 Kubernetes \u2013 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/controllers\/replicaset\/\" rel=\"noopener noreferrer nofollow\">ReplicaSet<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u044b \u0438 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043d\u0438\u043c\u0438<\/p>\n<p>\u041c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0434\u043b\u044f ReplicaSet \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 3 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043f\u043e\u0434\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0430\u043d\u0435\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 <em>sasha654\/webapiliveness<\/em>. \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0430 \u043c\u0435\u0442\u043a\u0430 <em>api: loremapi<\/em><\/p>\n<pre><code>apiVersion: apps\/v1 kind: ReplicaSet metadata:   name: myrs spec:   replicas: 3   selector:     matchLabels:       api: loremapi   template:     metadata:       labels:         api: loremapi     spec:       containers:       - name: webapiliveness         image: sasha654\/webapiliveness<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>kubectl create -f kuber-rs.yaml<\/code>, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0432\u0435\u0434\u0443 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 <code>kubectl get rs<\/code> \u0438 <code>kubectl get pods --show-labels <\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/abe\/1f7\/175\/abe1f71755c3e7425d0e7a6bd508858f.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u0438\u0437\u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u0440\u0435\u0441\u0443\u0440\u0441 \u0442\u0438\u043f\u0430 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/services-networking\/service\/\" rel=\"noopener noreferrer nofollow\">Service LoadBalancer<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430.  \u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u0443\u0436\u0431\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0434\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <em>spec<\/em><\/p>\n<pre><code>apiVersion: v1 kind: Service metadata:   name: mylb spec:   type: LoadBalancer   selector:     api: loremapi   ports:   - port: 8080     targetPort: 80<\/code><\/pre>\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 <code>kubectl get svc<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/184\/aa6\/024\/184aa6024162e0ef2e48adba8fee44eb.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438\u043b\u0438 <a href=\"https:\/\/www.postman.com\/\" rel=\"noopener noreferrer nofollow\">Postman<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u0441\u043b\u0443\u0436\u0431\u044b <code>http:\/\/localhost:8080\/api\/lorem<\/code>. \u0410 \u0441\u043b\u0443\u0436\u0431\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043d\u0435\u0439 \u043f\u043e\u0434\u043e\u0432<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a78\/b04\/f84\/a78b04f8403d56a2a96d4745cc9c9099.png\" width=\"1498\" height=\"832\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0439. \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a \u0441\u043b\u0443\u0436\u0431\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0434 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e, \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434. \u0418 \u0442\u0430\u043a \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u043e. \u0410 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434, \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0432 \u0444\u0430\u0439\u043b\u0435 <em>Program.cs<\/em> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 KeepAliveTimeout \u0440\u0430\u0432\u043d\u043e\u0435 1 \u0441\u0435\u043a\u0443\u043d\u0434\u0435, \u0432\u043c\u0435\u0441\u0442\u043e 2 \u043c\u0438\u043d\u0443\u0442, \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0412 \u0438\u0442\u043e\u0433\u0435, \u0435\u0441\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0435\u0436\u0435 \u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0434\u0430<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u0431\u043e\u0439 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432 \u043a\u0430\u043a\u043e\u043c-\u043b\u0438\u0431\u043e \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0430\u0434\u0435\u043d\u0438\u044e, \u0442\u043e Kubernetes \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 Pod \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437-\u0437\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0435\u0439 \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0443\u0437\u043b\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0442\u043e Kubernetes \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u044b\u0439 Pod<\/p>\n<p>\u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u044f \u0443\u0434\u0430\u043b\u044e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0434\u043e\u0432 <code>kubectl delete pod myrs-jqjsp<\/code>, \u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u043e\u0432\u044b\u0439, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/38b\/396\/126\/38b396126072acbe492f8b3e170785b6.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0434\u0430\u043b\u044e \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0438\u0437 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 <code>kubectl delete all --all<\/code><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b12\/c62\/ed2\/b12c62ed2d4712c67e36296323ec967b.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u0430\u0436\u0435 \u043d\u0435 \u0434\u0435\u043b\u0430\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, Kuberntes \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c<\/p>\n<p>\u041d\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0435\u0437 \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0430 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, Kubernetes \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0418 \u0437\u0434\u0435\u0441\u044c \u044f, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u0435\u0441\u0442\u0438\u0442\u044c Kubernetes, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432\u044b\u043d\u0443\u0434\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a<\/p>\n<p>\u041d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0435\u0441\u0442\u044c 3 \u0442\u0430\u043a\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 exec. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0, \u0442\u043e \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f TCP-\u043f\u043e\u0440\u0442\u0430. \u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u0442\u043e \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 GET-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0443. \u0415\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e, \u043a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u044f \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GET-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043e\u0431\u0440\u0430\u0437 \u043d\u0430 Docker Hub \u0441 \u0442\u0435\u0433\u043e\u043c 1, \u0442.\u043a. \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043a\u043e\u0440\u043e \u044f \u0438\u0437\u043c\u0435\u043d\u044e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u0434\u0435\u043b\u0430\u044e 2 \u0432\u0435\u0440\u0441\u0438\u044e \u043e\u0431\u0440\u0430\u0437\u0430<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/3cb\/14a\/155\/3cb14a155e32807584f02718051f1054.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0438\u0437\u043c\u0435\u043d\u044e \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 <em>LoremService<\/em> \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043b\u0435 \u043f\u044f\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043d\u044b\u043c, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0432\u043e\u0446\u0438\u0440\u0443\u044f Kubernetes \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u043e\u0434 \u0441 \u044d\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c<\/p>\n<pre><code class=\"cs\">using LoremNET; using System;  namespace WebApiLiveness.Services {     public class LoremService     {         private int _wordCountMin = 7;         private int _wordCountMax = 12;         private int _numRequestBeforeError = 5;         private int _requestCounter = 0;          public LoremService()         {             IsOk = true;         }          public bool IsOk { get; private set; }          public string GetSentence()         {             if (_requestCounter &lt; _numRequestBeforeError)             {                 _requestCounter++;                 var sentence = Lorem.Sentence(                     _wordCountMin, _wordCountMax);                 return sentence;             }             else             {                 IsOk = false;                 throw new InvalidOperationException(                     $\"{nameof(LoremService)} not available\");             }         }     } }<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e \u043d\u043e\u0432\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 <em>HealthController<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 GET-\u0437\u0430\u043f\u0440\u043e\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code class=\"cs\">using Microsoft.AspNetCore.Mvc; using System.Net; using WebApiLiveness.Services;  namespace WebApiLiveness.Controllers {     [ApiController]     [Route(\"api\/[controller]\")]     public class HealthController     {         private readonly LoremService _loremService;          public HealthController(LoremService loremService)         {             _loremService = loremService;         }          \/\/GET api\/health         [HttpGet]         public StatusCodeResult Get()         {             if (_loremService.IsOk)             {                 return new OkResult();             }             else             {                 return new StatusCodeResult(                     (int)HttpStatusCode.ServiceUnavailable);             }         }     } }<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0440\u0430\u043d\u0435\u0435, \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u0443\u044e \u043d\u043e\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0438 \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e \u043e\u0431\u0440\u0430\u0437 \u043d\u0430 Docker Hub, \u043d\u043e \u0443\u0436\u0435 \u0441 \u0442\u0435\u0433\u043e\u043c 2<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/343\/86d\/703\/34386d7034b3e306a246f200bdc5c5d9.png\" width=\"1252\" height=\"934\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u043c \u043d\u043e\u0432\u044b\u0439 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 ReplicaSet \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c, \u044d\u0442\u043e\u0442 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0442\u0435\u043c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u0433\u043e 1 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u043f\u043e\u0434\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u043e\u0432\u044b\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u043e\u043c <em>livenessProbe<\/em>, \u0433\u0434\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u043f\u0443\u0442\u044c \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f Kubernetes \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0436\u0438\u0432\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<pre><code>apiVersion: apps\/v1 kind: ReplicaSet metadata:   name: myrs spec:   replicas: 1   selector:     matchLabels:       api: loremapi   template:     metadata:       labels:         api: loremapi     spec:       containers:       - name: webapiliveness         image: sasha654\/webapiliveness:2         livenessProbe:           httpGet:             path: \/api\/health             port: 80           initialDelaySeconds: 10           periodSeconds: 3<\/code><\/pre>\n<p>\u041c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0441\u043b\u0443\u0436\u0431\u044b \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u041a\u0430\u043a \u0438 \u0440\u0430\u043d\u0435\u0435, \u0441\u043e\u0437\u0434\u0430\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u044b ReplicaSet \u0438 Service<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/bf0\/670\/8f6\/bf06708f63d1ac5c13fccc0dc155b1dd.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044e \u0431\u043e\u043b\u0435\u0435 5 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 <code>http:\/\/localhost:8080\/api\/lorem<\/code> \u0438 \u0442\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0443  \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/82a\/fd3\/17a\/82afd317a221de041466f26633d9fb6c.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0449\u0435\u043d \u0438 \u0441\u043d\u043e\u0432\u0430 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4bb\/e51\/163\/4bbe5116352d10a606771963fcd57b02.png\" width=\"1252\" height=\"714\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0437\u0433\u043b\u044f\u043d\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043e\u0442\u0447\u0435\u0442, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>kubectl describe pod myrs-787w2<\/code> <\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/35b\/e3a\/694\/35be3a69431570cde60455b07c67ff32.png\" width=\"1394\" height=\"956\"><figcaption><\/figcaption><\/figure>\n<p>\u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0436\u0438\u0437\u043d\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043c\u043e\u0449\u043d\u043e\u0435 \u0438 \u043f\u043e\u043b\u0435\u0437\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u0434\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0432 \u0446\u0435\u043b\u043e\u043c<\/p>\n<p>\u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e, \u043d\u043e \u0443\u043f\u043e\u043c\u044f\u043d\u0443 \u0435\u0449\u0435 \u043e\u0431 \u043e\u0434\u043d\u043e\u0439 \u0432\u0430\u0436\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c Kebernetes &#8212; \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 (Readiness). \u0418\u043d\u043e\u0433\u0434\u0430 \u044f \u043d\u0435 \u0445\u043e\u0447\u0443, \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u043b\u043e \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u0442.&nbsp;\u043a. \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445 \u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0438\u043b\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u043a\u0443\u044e-\u043b\u0438\u0431\u043e \u0434\u0440\u0443\u0433\u0443\u044e \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f, \u0434\u043e\u043b\u0436\u0435\u043d \u043b\u0438 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043f\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u043e \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0436\u0438\u0432\u043e\u0441\u0442\u044c, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434 \u043d\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0433\u043e\u0442\u043e\u0432\u043d\u043e\u0441\u0442\u0438, Kubernetes \u043d\u0435 \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<p>\u0412 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438 \u0443\u043f\u043e\u043c\u044f\u043d\u0443, \u0447\u0442\u043e ASP.NET \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u041f\u041e \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0433\u043e \u0441\u043b\u043e\u044f <a href=\"https:\/\/www.nuget.org\/packages\/Microsoft.AspNetCore.Diagnostics.HealthChecks\" rel=\"noopener noreferrer nofollow\">Microsoft.AspNetCore.Diagnostics.HealthChecks<\/a>, \u0443\u043f\u0440\u043e\u0449\u0430\u044e\u0449\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438. \u0412 \u0447\u0430\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0438\u043c\u0435\u044e\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0421\u0423\u0411\u0414 SQL Server \u0438\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 API<\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f <a href=\"https:\/\/github.com\/Sasha654\/WebApiLiveness\" rel=\"noopener noreferrer nofollow\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c<\/a><\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/535966\/\"> https:\/\/habr.com\/ru\/post\/535966\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0432 \u0440\u0430\u0431\u043e\u0447\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0433\u043b\u0430\u0432\u043d\u044b\u0445 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <a href=\"https:\/\/kubernetes.io\/\" rel=\"noopener noreferrer nofollow\">Kubernetes<\/a><\/p>\n<p>\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0445\u043e\u0442\u0435\u043b \u0431\u044b \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u043c \u0430\u0441\u043f\u0435\u043a\u0442\u0435, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0432 \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f \u0436\u0438\u0432\u044b \u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u044b \u0438 \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u043a \u043d\u0430\u043c, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u043f\u043e\u043c\u043e\u0447\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0440\u043a\u0435\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043d\u0430\u0447\u0430\u0442\u044c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes. \u042f \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0435 Docker Desktop. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0430\u043a\u0442\u0438\u0432\u0438\u0440\u043e\u0432\u0430\u0442\u044c Kubernetes \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u0445<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c Docker Desktop \u0432 Windows 10 \u043c\u043e\u0436\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u0438\u0437 \u043f\u0435\u0440\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u044d\u0442\u043e\u0439 <a href=\"https:\/\/habr.com\/ru\/post\/534504\/\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0430\u0442\u044c\u0438<\/a><\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 Web API<\/h2>\n<p>\u0414\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 ASP.NET Core Web API<\/p>\n<figure class=\"full-width\"><figcaption>\u041d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c WebApiLiveness<\/figcaption><\/figure>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e \u0447\u0435\u0440\u0435\u0437 Package Manager \u043f\u0430\u043a\u0435\u0442 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 <code>Install-Package Lorem.Universal.Net -Version 3.0.69<\/code><\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u044e \u0444\u0430\u0439\u043b <em>Program.cs<\/em><\/p>\n<pre><code class=\"cs\">using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; using System;  namespace WebApiLiveness {     public class Program     {         private static int _port = 80;         private static TimeSpan _kaTimeout = TimeSpan.FromSeconds(1);          public static void Main(string[] args)         {             CreateAndRunHost(args);         }          public static void CreateAndRunHost(string[] args)         {             var host = Host                 .CreateDefaultBuilder(args)                 .ConfigureWebHostDefaults(webBuilder =&gt;                 {                     webBuilder                         .UseKestrel(options =&gt;                          {                             options.ListenAnyIP(_port);                             options.Limits.KeepAliveTimeout = _kaTimeout;                         })                         .UseStartup&lt;Startup&gt;();                 })                 .Build();              host.Run();         }     } }<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441 <em>LoremService<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442<\/p>\n<pre><code class=\"cs\">using LoremNET;  namespace WebApiLiveness.Services {     public class LoremService     {         private int _wordCountMin = 7;         private int _wordCountMax = 12;          public string GetSentence()         {             var sentence = Lorem.Sentence(_wordCountMin, _wordCountMax);             return sentence;         }     } }<\/code><\/pre>\n<p>\u0412 \u043a\u043b\u0430\u0441\u0441\u0435 <em>Startup<\/em> \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0438\u0441<\/p>\n<pre><code class=\"cs\">public void ConfigureServices(IServiceCollection services) {     services.AddSingleton&lt;LoremService&gt;();     services.AddControllers(); }<\/code><\/pre>\n<p>\u0417\u0430\u043c\u0435\u043d\u044e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043d\u0430 <em>LoremController<\/em><\/p>\n<pre><code class=\"cs\">using Microsoft.AspNetCore.Mvc; using System; using System.Net; using WebApiLiveness.Services; using Env = System.Environment;  namespace WebApiLiveness.Controllers {   [ApiController]   [Route(\"api\/[controller]\")]   public class LoremController : ControllerBase   {     private readonly LoremService _loremService;      public LoremController(LoremService loremService)     {         _loremService = loremService;     }      \/\/GET api\/lorem     [HttpGet]     public ActionResult&lt;string&gt; Get()     {       try       {           var localIp = Request.HttpContext.Connection.LocalIpAddress;           var loremText = _loremService.GetSentence();           var result =             $\"{Env.MachineName} ({localIp}){Env.NewLine}{loremText}\";           return result;       }       catch (Exception)       {           return new StatusCodeResult(             (int)HttpStatusCode.ServiceUnavailable);       }     }   } }<\/code><\/pre>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0434\u043e\u0431\u0430\u0432\u043b\u044e \u0444\u0430\u0439\u043b <em>Dockerfile<\/em> \u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c.  \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u0437\u044f\u0442 \u043e\u0431\u0440\u0430\u0437, \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 ASP.NET \u0441 \u0432\u0435\u0440\u0441\u0438\u0435\u0439 .NET 5<\/p>\n<pre><code>FROM mcr.microsoft.com\/dotnet\/aspnet:5.0-buster-slim COPY bin\/Release\/net5.0\/linux-x64\/publish\/ App\/ WORKDIR \/App ENTRYPOINT [\"dotnet\", \"WebApiLiveness.dll\"]<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/p>\n<figure class=\"\"><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/figcaption><\/figure>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0437\u0430<\/h2>\n<p>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u044e \u0440\u0435\u043b\u0438\u0437 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f <code>dotnet publish -c Release -r linux-x64<\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u043c \u043e\u0431\u0440\u0430\u0437, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u043d\u0435\u0435 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439 Dockerfile. \u0412\u044b\u043f\u043e\u043b\u043d\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u0438\u0437 \u043f\u0430\u043f\u043a\u0438, \u0433\u0434\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b  <code>docker build -t sasha654\/webapiliveness .<\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044e \u043e\u0431\u0440\u0430\u0437 \u0432 <a href=\"https:\/\/hub.docker.com\/\" rel=\"noopener noreferrer nofollow\">Docker Hub<\/a> <code>docker push sasha654\/webapiliveness<\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u042f \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u043b \u043e\u0431\u0440\u0430\u0437 \u0432 \u043e\u0431\u0449\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043b\u044e\u0431\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432 \u0441\u0432\u043e\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 Docker Hub, \u0442\u043e \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 <em>sasha654<\/em> \u0441\u0432\u043e\u0439 Docker ID, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 Kubernetes, \u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044e, \u0447\u0442\u043e \u043d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0432\u0441\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438 \u0437\u0430\u043f\u0443\u0449\u0443 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0438\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0447\u0435\u0440\u0435\u0437 Docker <code>docker run -p 8080:80 -d sasha654\/webapiliveness<\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0418 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044e \u0437\u0430\u043f\u0440\u043e\u0441 <code>curl http:\/\/localhost:8080\/api\/lorem<\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e! \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e \u0438 \u0443\u0434\u0430\u043b\u044e \u044d\u0442\u043e\u0442, \u0443\u0436\u0435 \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0439, \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Kubernetes<\/h2>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0435\u0434\u0438\u043d\u0438\u0446\u0435\u0439 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0432 Kubernetes, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/pods\/\" rel=\"noopener noreferrer nofollow\">Pod<\/a> \u2013 \u044d\u0442\u043e \u0433\u0440\u0443\u043f\u043f\u0430, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e (\u0447\u0430\u0449\u0435) \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 (\u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0440\u0435\u0436\u0435) \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 <\/p>\n<p>\u041f\u043e\u0434\u044b \u043f\u043e\u0447\u0442\u0438 \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0432\u0440\u0443\u0447\u043d\u0443\u044e. \u0418 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u0434\u0440\u0443\u0433\u043e\u0439 \u0440\u0435\u0441\u0443\u0440\u0441 Kubernetes \u2013 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/workloads\/controllers\/replicaset\/\" rel=\"noopener noreferrer nofollow\">ReplicaSet<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u044b \u0438 \u0441\u043b\u0435\u0434\u0438\u0442\u044c \u0437\u0430 \u043d\u0438\u043c\u0438<\/p>\n<p>\u041c\u0430\u043d\u0438\u0444\u0435\u0441\u0442 \u0434\u043b\u044f ReplicaSet \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 3 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432 \u043f\u043e\u0434\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0440\u0430\u043d\u0435\u0435 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430 <em>sasha654\/webapiliveness<\/em>. \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u0430 \u043c\u0435\u0442\u043a\u0430 <em>api: loremapi<\/em><\/p>\n<pre><code>apiVersion: apps\/v1 kind: ReplicaSet metadata:   name: myrs spec:   replicas: 3   selector:     matchLabels:       api: loremapi   template:     metadata:       labels:         api: loremapi     spec:       containers:       - name: webapiliveness         image: sasha654\/webapiliveness<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>kubectl create -f kuber-rs.yaml<\/code>, \u0430 \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0432\u0435\u0434\u0443 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u0445 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 <code>kubectl get rs<\/code> \u0438 <code>kubectl get pods --show-labels <\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c \u0438\u0437\u0432\u043d\u0435 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u044f \u0441\u043e\u0437\u0434\u0430\u043c \u0440\u0435\u0441\u0443\u0440\u0441 \u0442\u0438\u043f\u0430 <a href=\"https:\/\/kubernetes.io\/docs\/concepts\/services-networking\/service\/\" rel=\"noopener noreferrer nofollow\">Service LoadBalancer<\/a> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430.  \u0417\u0434\u0435\u0441\u044c \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u0443\u0436\u0431\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u043e\u0434\u0430\u043c \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0435\u043b\u0435\u043a\u0442\u043e\u0440\u0430, \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 <em>spec<\/em><\/p>\n<pre><code>apiVersion: v1 kind: Service metadata:   name: mylb spec:   type: LoadBalancer   selector:     api: loremapi   ports:   - port: 8080     targetPort: 80<\/code><\/pre>\n<p>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u0435 <code>kubectl get svc<\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438\u043b\u0438 <a href=\"https:\/\/www.postman.com\/\" rel=\"noopener noreferrer nofollow\">Postman<\/a> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0430\u0434\u0440\u0435\u0441 \u0441\u043b\u0443\u0436\u0431\u044b <code>http:\/\/localhost:8080\/api\/lorem<\/code>. \u0410 \u0441\u043b\u0443\u0436\u0431\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u043e\u0434\u043d\u043e\u043c\u0443 \u0438\u0437 \u043e\u0442\u043d\u043e\u0441\u044f\u0449\u0438\u0445\u0441\u044f \u043a \u043d\u0435\u0439 \u043f\u043e\u0434\u043e\u0432<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0417\u0434\u0435\u0441\u044c \u044f \u0431\u044b \u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0441\u0435\u0441\u0441\u0438\u0439. \u041f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u043a \u0441\u043b\u0443\u0436\u0431\u0435 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0439 \u043f\u043e\u0434 \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432\u0441\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e, \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432 \u044d\u0442\u043e\u0442 \u0436\u0435 \u043f\u043e\u0434. \u0418 \u0442\u0430\u043a \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043a\u0440\u044b\u0442\u043e. \u0410 \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432\u0441\u0435 \u0442\u0430\u043a\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0434, \u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b \u0432 \u0444\u0430\u0439\u043b\u0435 <em>Program.cs<\/em> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 KeepAliveTimeout \u0440\u0430\u0432\u043d\u043e\u0435 1 \u0441\u0435\u043a\u0443\u043d\u0434\u0435, \u0432\u043c\u0435\u0441\u0442\u043e 2 \u043c\u0438\u043d\u0443\u0442, \u043f\u0440\u0438\u043d\u044f\u0442\u044b\u0445 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0412 \u0438\u0442\u043e\u0433\u0435, \u0435\u0441\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0440\u0435\u0436\u0435 \u043e\u0434\u043d\u043e\u0439 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0442\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u043d\u0443\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u0432\u044b\u0431\u043e\u0440 \u043f\u043e\u0434\u0430<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0441\u0431\u043e\u0439 \u0433\u043b\u0430\u0432\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0432 \u043a\u0430\u043a\u043e\u043c-\u043b\u0438\u0431\u043e \u0438\u0437 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043f\u0430\u0434\u0435\u043d\u0438\u044e, \u0442\u043e Kubernetes \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0435\u0433\u043e. \u0415\u0441\u043b\u0438 Pod \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u0437-\u0437\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0448\u0435\u0439 \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043d\u043e\u0441\u0442\u0438 \u0443\u0437\u043b\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430, \u0442\u043e Kubernetes \u0441\u043e\u0437\u0434\u0430\u0441\u0442 \u043d\u043e\u0432\u044b\u0439 Pod<\/p>\n<p>\u0422\u0430\u043a, \u0435\u0441\u043b\u0438 \u044f \u0443\u0434\u0430\u043b\u044e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u0434\u043e\u0432 <code>kubectl delete pod myrs-jqjsp<\/code>, \u0442\u043e \u043f\u043e\u0447\u0442\u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u043e\u0432\u044b\u0439, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u0431\u0430\u043b\u0430\u043d\u0441 \u043c\u0435\u0436\u0434\u0443 \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u043c \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u0432<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0423\u0434\u0430\u043b\u044e \u0432\u0441\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b \u0438\u0437 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 <code>kubectl delete all --all<\/code><\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0434\u0430\u0436\u0435 \u043d\u0435 \u0434\u0435\u043b\u0430\u044f \u043d\u0438\u0447\u0435\u0433\u043e \u0432 \u0441\u0430\u043c\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, Kuberntes \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0432\u044b\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0441\u0442\u044c<\/p>\n<p>\u041d\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0431\u0435\u0437 \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430, \u0430 \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440 \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f, Kubernetes \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0418 \u0437\u0434\u0435\u0441\u044c \u044f, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a, \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0437\u0430\u0431\u043e\u0442\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0432\u0435\u0441\u0442\u0438\u0442\u044c Kubernetes, \u0447\u0442\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0438 \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0432\u044b\u043d\u0443\u0434\u0438\u0442\u044c \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a<\/p>\n<p>\u041d\u0430 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0435\u0441\u0442\u044c 3 \u0442\u0430\u043a\u0438\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u0430<\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 exec. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 0, \u0442\u043e \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f TCP-\u043f\u043e\u0440\u0442\u0430. \u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e, \u0442\u043e \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439 GET-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u043c\u0443 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0443. \u0415\u0441\u043b\u0438 \u043e\u0442\u0432\u0435\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d \u0438 \u043a\u043e\u0434 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u043e, \u043a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0432\u0441\u0435 \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u044f \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GET-\u0437\u0430\u043f\u0440\u043e\u0441\u0430. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u044f \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u0443\u044e \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043e\u0431\u0440\u0430\u0437 \u043d\u0430 Docker Hub \u0441 \u0442\u0435\u0433\u043e\u043c 1, \u0442.\u043a. \u0441\u043e\u0432\u0441\u0435\u043c \u0441\u043a\u043e\u0440\u043e \u044f \u0438\u0437\u043c\u0435\u043d\u044e \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438 \u0441\u0434\u0435\u043b\u0430\u044e 2 \u0432\u0435\u0440\u0441\u0438\u044e \u043e\u0431\u0440\u0430\u0437\u0430<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0438\u0437\u043c\u0435\u043d\u044e \u043a\u043e\u0434 \u043a\u043b\u0430\u0441\u0441\u0430 <em>LoremService<\/em> \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0441\u043b\u0435 \u043f\u044f\u0442\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a API, \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0438\u0441\u043f\u0440\u0430\u0432\u043d\u044b\u043c, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u0440\u043e\u0432\u043e\u0446\u0438\u0440\u0443\u044f Kubernetes \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u043e\u0434 \u0441 \u044d\u0442\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c<\/p>\n<pre><code class=\"cs\">using LoremNET; using System;  namespace WebApiLiveness.Services {     public class LoremService     {         private int _wordCountMin = 7;         private int _wordCountMax = 12;         private int _numRequestBeforeError = 5;         private int _requestCounter = 0;          public LoremService()         {             IsOk = true;         }          public bool IsOk { get; private set; }          public string GetSentence()         {             if (_requestCounter &lt; _numRequestBeforeError)             {                 _requestCounter++;                 var sentence = Lorem.Sentence(                     _wordCountMin, _wordCountMax);                 return sentence;             }             else             {                 IsOk = false;                 throw new InvalidOperationException(                     $\"{nameof(LoremService)} not available\");             }         }     } }<\/code><\/pre>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044e<\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-315929","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315929","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=315929"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/315929\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}