 Cloud Native. , Docker Kubernetes
 


       Cloud Native:  ,    12              Docker    Kubernetes Cloud Native               .





 Cloud Native. , Docker Kubernetes



 



 ,2022



ISBN978-5-4498-3387-7

     Ridero








            .                ,     Cloud      ,    ,       Docker,      Kubernetes        ,            .

        ,    ,    (Cloud Native),      ,       , ,    Kubernetes            ,       .




  . -


   ,     ,           .      , ,      ,      , ,  .

           ,       API,     (  Amazon AWS, Google Cloud,  Yandex SberCloud). 堖   ,     ,       Docker,   Kubernetes.

     ,    docker.io  kubernetes.io.  , Google, Amazon       ,   ,          ,   Kubernetes.  , , -       頖    ,       ,      .

 ,    㠖   ,   ,      , , ,  ,    . ,  ,   ,      Cloud Native.        ,   ,      ,   ,   , ,   Cloud Native.




 


     ,     ,    堖 ,        AWS,   ,       (   CLI,    desktop,   ),      web  .             HTTP,  .

 ,          (loud),                      (cluster),    ,            ,        ,   ,      Kubernetes, Docker    .      ,             ,        .

 ,        (monolith) ,    (dedicated)   ,     ,    ,     .     ,   , ,    ,    ,        ,      Kubernetes,    Cloud Native ( ,   ).




 .  Cloud Native


Π   ?       ,     ,         .  ,    ,   ,       (cloud native applications).     ,       ( ,   ,          ).    ,   ,          (Docker Kubernetes),        ,        ,              .

   ,    ()      , ,  ,     .         ,     ,           頖       (    Kubernetes).  ,    ,   ,     ,  . ,        젖      GitHub,  KubeCon,  .

 

    Cloud Native  Kubernetes         ,     ,   ,      .     ,  ,         ,    ,             .           .               ,     .




 


          , , ,    .    ,  ,     ,    ,       ,     StackOverflow,  .

 ,      ,       ,      ,    ,   .             ,           . ,  , , , ,  ,        ,         .             ,    ,       (? ?   ?  蠫?                ,    ).




 


       ,     ,     (minimal viable product, MVP),    ,     ,   .        ,  ,    .  ,    , ,    ,    . ,   web ,   iOS Android,        ,     .    ,    .        ,       .




   GitHub


   ,      Docker Kubernetes,    ivanporty/cloud-docker-k8s GitHub.    ( ,   )       (CI) c  GitHub Actions         ,   - .      ,     ,    Kubernetes   Docker - ,       ,  ,    .




 Go Java


Go      ,    ,     .       ,      - ,    , ,  .

  ,  Go       ,     ,      .  ,    ,   ,     ,   ,  ,    ,   ,  Python,      Node. js Java,      (just intime, JIT)    .   ,     (       ,   ),    .                  .

,                 ,   Linux?                ?    , ,    Docker,       ,     ,       . ,         ,  Docker      ,            .

  Java      ,       ,    -,    .         Go,      (domain)  (   ,     ),   ,    ,      ,    Java     .

,    Java              .       ,    JRE,   ,       JAR.    GraalVM Oracle,   ,  - ,   Quarkus Microprofile,   .




  


         .     (  )   ,      ,      .  , ,              .   , ,       ,      .

    ,    堫    .      ,      .   ,        ,          .            .   .




   㠖 Amazon, Google, Microsoft


  (, Docker,   Kubernetes)  ,    Cloud Native,       ,       Amazon Web Services (AWS), Google Cloud Platform (GCP), Microsoft Azure,  #CloudMTS SberCloud,    ,       (Digital Ocean).    ,      ,    ,     ,    ,  ,       .        ,   ,    .




    ipsoftware.ru


   ,       LeanPub  Ridero.      ,        ,     (       ,   ).     ,      ,       .

     ,  ,    .     Markdown  LeanPub,      Ridero.           www.ipsoftware.ru,          .  ,      ,     .      ,       ,            .




 . 


    (free open source)    GitHub    ( ivanporty/cloud-docker-k8s-book).    , ,  ,  -  ,   (pull request),   ,       .    ,      (    GitHub):

AdamPirson

lex111 (Alexey Pyltsyn)

alg (Aleksey Gureiev)




1.,   ࠖ  Cloud Native



 Cloud Native     ,   ,     Cloud.     ,   (service mesh), ,      .

  Cloud Native Foundation,     .

   ,  ,     ,       .       .   ,           .        ,    ,           ,   Google, Apple Yandex,      .      ,    .    ,      .




   Cloud Native


     ,      ,   ,     ,       .  ,      ,    ,           ,  ,  .

       (microservices),         .     ,    ,     HTTP  REST.         .         ,         .     .    ,   ,    (monolith).

     ,     ,       -   ,   .      (containers).    ,      ,   ,      .     .          Linux,   ,    ,     .

  ,   ,   ⠖    .              ,      .       ,   (   )      ,   Google Cloud (GCP), Amazon Web Services (AWS), SberCloud, Yandex.Cloud.

, ,   ,    ,    ,      ,      .       (orchestrator),        Kubernetes.     , ,   ,    (logs)     ,   Kubernetes.

 

  ,      ,  ,   ,    , ,      .       ,      (cloud native).    :

 (microservices)         .    ,       ,   ,        .

 (containers)       (  Linux),    ,      .           ,    .

,       ,        .     , ,     .  ,     ,    .             .

  ,    ,    .      Kubernetes, ,  ,  , , ,     .        .

 (monitoring)     ,          .        (logs).  ,           .

    ,  ,        Cloud Native.




     


 (microservices)        .       ,  ,  ,      頖   .   , , ,           .

    ,             ,   ,     ( HTTP  gRPC) .

                 .       ,     (  ),   .      (horizontal scaling  scaling out)       ,      ,        .          ,   ,  ,     .

     ,   ,       .          ,        ,    ,   .        , -             .

              ,  ,     .        .             (CI/CD, continuous integration and delivery),     ,    ,     .

         蠖   ,      ,   ,    .           .   ,  ,    .

            .




    


   ,           ,  .     ,        .       ,        ( )    .

     ,   .       ,   ,          .    ,           Linux (       ).        Linux,  ,   ,         .

  (     ),    ,   (image).       (immutability),    ,  ,  .          . Ѡ    ,   - ,     ,      ,         .     (reproducibility)     ,  .     ,             .

          ,      ,      蠖 Docker.




   .   


   ,  ,         ,         (production),   .        ,   (operators),      .        ,       .

               .         ,     ,            ,       .

        ,        (    ),            .            ,  .

    ,     ,       (,    ).  ,      ,   ,       .         .    Terraform Ansible. ,  ,   ,  ,     (immutable infrastructure).

 ,     ,       ,          .         .         DevOps (, development + operations).

          , ,   c  .   ,   Amazon AWS, Google GCP  Yandex.Cloud,        ,     ,       .   DevOps            .

      .            (     Linux).          ,      ,   .           .      , ,   ,   DevOps,         ,   ,          .

,         .              ,    ,       .     Kubernetes.




 Kubernetes   


 ,  ,      ,  ,       .  Kubernetes,      Google    Borg,        ,  .     , Google Cloud, AWS, Azure,  Yandex.Cloud, #CloudMTS ,      Kubernetes.

  Kubernetes   GitHub,         ,   .  Kubernetes   ,   ,      ,     ,   Docker for Desktop, Kind Minikube.

     Cloud Native,       .   Kubernetes  ,      (  )    ,      (desired state).    ,    ,   Kubernetes  ,       .    YAML.  ,  Kubernetes,     ,     .




    


   ,    ,  ,      ,        .    ,  (logs)     ,      , ,          .

  Cloud Native  ,    ,       .      (service mesh),   Istio Linkerd.   service mesh      ,      ,   ,   .     ,     ,  ,  ,  .   ,   Prometheus,         (,  Grafana).  ,  Fluentd,      ,  .      ,      .




 堖 12  


  Cloud Native,   ,   ,    ,          .       ,  ,      ,    ,      ,       .

   Heroku,       ,     12 (12factor app),                .   , ,  ,   ,       .    , ,      Cloud Native.

1  

  ,        (GitHub  - ).        -       .       ,    .

2    

      ,    -    .        蠖          (  Dockerfile),          JAR,  Node. js,  .

3  

         䠖  ,   ,   -.       Kubernetes. ,          (environment variables),   ,    (secrets)   (config maps).   ,  YAML.   ,         , ,  ,      .

4    

,     ,    ,   ,  -,      .      ,                    . ,   Kubernetes  .           Kubernetes (CRD, custom resource definition).

5     

       .     (CI, continuous integration)      (tag),          .      (image) ⠖    ,       ( Docker Hub),      ,      .

6   

                 (stateless, share-nothing).       .     ,          .       ,   젖    (Cloud SQL, Amazon RDS),  Memcached, .   ,         Docker  Kubernetes.

7    

    ,   HTTP  REST,    JSON  XML,     gRPC.     -,       , ,      (service discovery).     ,  ,      ,  (service) Kubernetes, ,      . Kubernetes       DNS.     HTTP     ( ,  Netty  Java).

8     

          ,     堖        ( 6). Kubernetes  ,      ,  ,     .

9    

     ,      ,     .    Linux      ,     .      -    , ,    .

10    

   ,     , ,  ,   ,         ,     .         ,    ,      (production),     ,     (dev environment).

 12     ࠖ  ,  ,     ,      .                 .  ,      ,       .      .

  Kubernetes      ,     ,    ,  ,    YAML.   2, 3, 46      .  ,    ,       ,   DevOps.

11  logs   

      , .    ,      (, Log4J  Java).        .         ,      ,         .

     .      (standard output),  ,      .      Kubernetes.   (ELK ElasticSearch + Logstash + Kibana,  Fluentd),    Kubernetes,    , ,  ,     .

12    

  ,          ,     ,       ,  .  ,      ,  ,   .        (deployment) Kubernetes     .







    Cloud Native,  ,        ,    ,    ,   PHP MySQL,  ,      ,   ,  ,     .       ,      ,       ,  ,   ,   Google Yandex.




2.



   ,         .        ,    頖        , ,        .

  (Martin Fowler),   ,    ).

    ,   ,    (cloud native),            (microservices),            Netflix, Twitter, Uber,   Amazon.

 ,   ,         SOA (service oriented architecture),     ,  .     ,   ,    .      (monolith), ,      ,       ,  ,     .   ,             .

        ,    ,   ,      ,  ,      .

   ,   ,   ,     ,     ,    ,         .    ( ,    HTTP/JSON,    gRPC),     ,   ,      .

     -  ,   ,       ,  ,  ,     .







   (monolith)   ,       .           .        (  GitHub),     (    , DRY dont repeat yourself!),         ,  ,    (branch).    ,    ,      ,    .        .

,    ,       Web  ,     .

  

            ,      .              .        ,     (HTTP/REST),      ,     ,      .

 ,       ,   . ,      ,      ,   ,     .    ,      ,        .

  

 ,  ,           .        ,     ,             .  ,     ,     ,          ,    ,  .     .

   ,    (   )             ,        ,            .

  

,   ,        ,           (  ),      ,     .

 ,       .    ,     ,       .          ,    ,      .            . ,      ,       .  ,      ,   ,                ,      .

 

     ,  ,    .         ,     (vertical scaling,      ),   (horizontal scaling,    ,       (replicas,  instances).

         , ,   ,        ,       . Ѡ ,    ,      .          (     !),        10   Java-,       .        .

       .    ,    ,  ,           (  ), ,   ,    . Kubernetes    .




   (SOA)


      ,   ,    ,   .       (service oriented architecture, SOA).

   ,      ,              .         .

 ,           - ,      (middleware),   ,      ,     (ESB, enterprise service bus).                .




  


   ,  ,       ,   , ,  ,   , ,    .        .

       ,  ,        ,    ,    .  ,   ,  ,    ,    ,     .  .

   

 (component)     .  ࠖ    ,  API,    . 堖    ,  ,  ,      .      ,   (upgrade)             .     (, JAR), ,  ,  ,      .

    (,  )    ,   ,   ,  ,   ,    RESTful API HTTP / GRPC.

 ,  

        (   SOA, service oriented architecture).   SOA    - (middleware),      (message queue),  ,       ,    ESB (enterprise service bus).          ,  ESB.

      - (anti-pattern).         (   , smart endpoint),      .  (    ),    ,    (  ,    , dumb pipes).

  

      ,  ,  ,       SQL.     ࠖ    ,     .  ,         API,  .

,  ,      .       , ,   NoSQL,   ,  ,  - . ,    ,    ,     , ,    .

 

     ,     , ,            .      .

   (CI, continuous integration),     (CD, continuous delivery)    ,  .     ,  ,  , 蠫,  ,   ,     Kubernetes,    .      ,       .

 

  , ,  .      , -  , ,  ,  .  ,     ,            .

        ,   . ,  Netflix    (Chaos Monkey,  ,      !),  ,      .      ,    ,      ,        .

 ,   -

      (    Amazon,  ,   ,     .    , ,  蠖         10).   ,             .

         (back end),   (front end,  UI),   .     ,  -.    ,  ,  ,  .       ,  ,   ,  .

 ,      , , ,  蠖   .    ,   ,     API.

,       ,   蠖         ,    ,  ,   .      (Conways law),            .

 ,  

,   ,     ,      (requirements).    ,   ?     - ,   ,    ,      .  ,  ,       .

  ,     (own)     ,    ,     ,      .    ,         ,    .       DevOps (developer + operations,     ,     ).  Kubernetes      DevOps.

 

  (evolutionary design)     ,     ,    ,    ,   (Joshua Kerievsky),  Agile/XP-.

      ,     ,      ,     ,       .        ,     (primitive whole).    ,   .      , ,      , , .     .

         ,    ,    ,          . Ӡ  蠖      ,    ⠖      ,       .

 

      .   ,      ,   ,   Kubernetes   .      ,  ,     .         (latency),        (asynchronous),  ,       .

 , ,       ,  .      ,     ,    -.         (distributed monolith), ,  ,        .

,      Cloud Native    ,  SOA!      ,   Enterprise Java    Kubernetes,      .

   ,   (Sam Newman),  , ,  ,  ,     ,      (        ).




  


    ,   ,  ,   堖  ,  ,  ,     ,  .      Kubernetes,        ,      ?

    ,     ,      ,    .     (boundary)  ,  ,     API,     ,       .

       ,  ,   ,    (domain),    .   DDD,        (domain driven design).         .  ,       , ,   ,     ,            .

    ⠖              .        ,      ,      REST/gRPC    .

     ,    .      DDD,        (bounded context)  ,   .            ,     ,    . ,     ,    ,   .

  ,     ,  ,        .        ,  ,   ,  .      ,      , ,      .




  


  砖   ,  ,         ,    .           ,      API,  Kubernetes     ,   ,    ,   .

      IDE,      ,    .          .   (logs)  ,    , .          ,      .      .    .   .      ,   SSL, , ,     .

  蠖      Cloud Native        .     ,     .   ࠖ     ,  ,  ࠖ       (service mesh)   Istio Linkerd.       .      ,   ELK (Elastic, Logstash, Kibana),  Fluentd.  OpenTracing,  Prometheus,  Grafana       ,   ,       .

 ,     ,    ,            .







  ,    Kubernetes    .  ,     ,   ,        .     ⠖   ,       (domain).          ,       ,          .

      ,     :

  (Sam Newman),  

  (Sam Newman),  

www.cncf.io    Cloud Native Foundation,    (projects),     ,   OpenTracing Prometheus.

   KubeCon        ,    YouTube.

  (Eric Evans), -  (DDD).

www.martinfowler.com     . -   .




3. Docker



 (containers)    ,         .             ,       .

   ,   ,          ,          Unix (   Linux). Ѡ            ,       ,      .      蠖         Unix,          ,    ,       (HTTP 80, HTTPS 443..)

            ( , development environment,    , QA environment).            ,      (production) .                 (production),      , ,   .         .

 ,  ,     .            .     ,    ,       (hypervisor).       (  )        (  ).         ,     .             ,      (virtual machine),      ,     .       ,      ,      .       ,      ,   -    .     ,    IP-,     .

       .     Cloud (Amazon, Google, Yandex )    .     (data center)     ,           (bandwidth).    ,     ,         -,    ,    .         ⠖   ,              ,          .  ,           ,        .     ,         .

 ,  ,        ,      ,   .     ,    ,   ,  ,  ,     (package manager),    (shell),      ,      ().       젖               ,     ,      .

,               ,       .

   ,           ,   ,  

    ⠖ ,       .         ,               .

 -                  ,  ,     .

      .        ,  ,  ,          .




  Linux


    ,    ,     ,        .       ,    (kernel)   Linux.        ,    (     ),   ,   CPU, ,  .          IP-   ,       /,   , ,   ,     ,    .




  .


   .

   ,     (https://www.litres.ru/ivan-portyankin-2219/programmirovanie-cloud-native-mikroservisy-docker-i-k/)  .

      Visa, MasterCard, Maestro,    ,   ,     ,  PayPal, WebMoney, ., QIWI ,       .


