Näkyvyyden rakentaminen konttipohjaiseen moniklusteriympäristöön
Jokipelto, Juha-Mikko Ensio (2022)
Jokipelto, Juha-Mikko Ensio
2022
All rights reserved. This publication is copyrighted. You may download, display and print it for Your own personal use. Commercial use is prohibited.
Julkaisun pysyvä osoite on
https://urn.fi/URN:NBN:fi:amk-202204286329
https://urn.fi/URN:NBN:fi:amk-202204286329
Tiivistelmä
Opinnäytetyön aiheena oli tutkia eri tapoja tuottaa näkyvyyttä konttipohjaiseen moniklusteriympäristön julkaisu- ja hallintajärjestelmän tilaan. Lisäksi opinnäytetyössä käytiin läpi yleisellä tasolla modernia palvelutuotantoa konttipohjaisessa ympäristössä ja tutkittiin malleja, periaatteita sekä teknologioita, jotka toimivat sen mahdollistajina. Lisäksi tutkimus teki syvällisempää selvitystä konttiteknologian juurista ja nykytilasta sekä teknologiasta, joka mahdollistaa konttipohjaisien työkuormien orkestroinnin ja klusterien hallinnoinnin.
Tutkimustyön pohjalta alettiin rakentamaan omaa konseptia, jonka tavoitteena oli tuottaa näkyvyyttä tietyn GitOps-malliin pohjautuvan julkaisu- ja hallintajärjestelmän tilaan. Näkyvyyttä rakennettiin hyödyntämällä Kubernetes-natiivia Operaattori-ohjelmointikaavaa. Luomalla uuden mukautetun resurssin Kubernetes-rajapintapalvelinta voidaan jatkaa lisäämällä siihen uusi päätepiste. Kun mukautetun resurssin tilan sovittelemista varten luodaan mukautettu kontrolleri, saadaan uusi Operaattori. Valmis resurssi muistuttaa normaalia Kubernetes-resurssia toiminnallisuudeltaan, joten sitä pystyy myös hyödyntämään komentorivityökalun avulla. Opinnäytetyössä toteutettiin Operaattori, joka seuraa resurssien tilaa ja sovittelee sen muutokset päivittämällä ne omaan mukautettuun resurssiin. Lisäksi rakennettiin kontrolleri, joka välittää mukautetusta resurssista tilan klusterin ulkopuolelle JSON-sanoman muodossa.
Opinnäytetyön Operaattori-toteutuksen avulla onnistuttiin rakentamaan näkyvyyttä haluttuun resurssiin ja välittämään se automaattisesti klusterin ulkopuolelle standardoidussa muodossa. Tuotettua prototyyppiä voi tulevaisuudessa hyödyntää myös alustana muunlaiselle operointityön automatisoinnille, koska se tarjoaa jo valmiin toiminnallisuuden resurssien seuraamiselle ja seurattavien muutosten sovittamiselle ohjelmallisesti. Lisäksi jatkokehitystyönä voisi tutkia julkaisuautomaation rakentamista prototyyppitoteutuksen pohjalta. Operaattori tarjoaa hyvin voimakkaan työkalun Kubernetes-klusterin räätälöimiseen ja automatisointiin. The purpose of this research was to find ways to build observability to a container-based multi-cluster environment deployment and management system. The research also touches on modern service production in container-based environment, and the enabling techniques and models, which allow these even more complex solutions to arise. The technologies covered in the research include microservices and distributed systems, CI/CD and GitOps, containers and Kubernetes. The research makes a deep dive into bases of container technology to build a better understanding of the higher-level abstraction build upon containers e.g. Kubernetes.
The implementation of the research takes advantage of a Kubernetes-native design pattern called Operator. The Operator consists of a custom resource, which extends the Kubernetes API-server and a custom controller or controllers which watch for changes in the resource state and reconciliate the changes with a custom build programming logic. In the implementation the Operator watches for a special resource which belongs to the deployment and management system and reconciles changes to that resource. It reconciles by updating the watched state of the resource to its’ own custom resource. There is also another controller which watches for the state of the custom resource and reconciliates the changes to it by sending a JSON-message to a configurable endpoint outside of the cluster. This was done so the custom data could be utilized in a monitoring system, but it also opens an opportunity to take advantage of this message in other systems as well, like Teams, Slack or even email.
The implementation was able to produce more observability to the set system. As a result the information was also very human readable and customizable. The prototype which was born during the proof of concept constructs an extensible platform to build other automated workflows’ on. It provides the basic ability to watch a set resource or a state in a particular type of resource and you can program any custom way to reconciliate the observed state. Based on the research an Operator is a very powerful tool for extending your Kubernetes cluster with custom logic or automation.
Tutkimustyön pohjalta alettiin rakentamaan omaa konseptia, jonka tavoitteena oli tuottaa näkyvyyttä tietyn GitOps-malliin pohjautuvan julkaisu- ja hallintajärjestelmän tilaan. Näkyvyyttä rakennettiin hyödyntämällä Kubernetes-natiivia Operaattori-ohjelmointikaavaa. Luomalla uuden mukautetun resurssin Kubernetes-rajapintapalvelinta voidaan jatkaa lisäämällä siihen uusi päätepiste. Kun mukautetun resurssin tilan sovittelemista varten luodaan mukautettu kontrolleri, saadaan uusi Operaattori. Valmis resurssi muistuttaa normaalia Kubernetes-resurssia toiminnallisuudeltaan, joten sitä pystyy myös hyödyntämään komentorivityökalun avulla. Opinnäytetyössä toteutettiin Operaattori, joka seuraa resurssien tilaa ja sovittelee sen muutokset päivittämällä ne omaan mukautettuun resurssiin. Lisäksi rakennettiin kontrolleri, joka välittää mukautetusta resurssista tilan klusterin ulkopuolelle JSON-sanoman muodossa.
Opinnäytetyön Operaattori-toteutuksen avulla onnistuttiin rakentamaan näkyvyyttä haluttuun resurssiin ja välittämään se automaattisesti klusterin ulkopuolelle standardoidussa muodossa. Tuotettua prototyyppiä voi tulevaisuudessa hyödyntää myös alustana muunlaiselle operointityön automatisoinnille, koska se tarjoaa jo valmiin toiminnallisuuden resurssien seuraamiselle ja seurattavien muutosten sovittamiselle ohjelmallisesti. Lisäksi jatkokehitystyönä voisi tutkia julkaisuautomaation rakentamista prototyyppitoteutuksen pohjalta. Operaattori tarjoaa hyvin voimakkaan työkalun Kubernetes-klusterin räätälöimiseen ja automatisointiin.
The implementation of the research takes advantage of a Kubernetes-native design pattern called Operator. The Operator consists of a custom resource, which extends the Kubernetes API-server and a custom controller or controllers which watch for changes in the resource state and reconciliate the changes with a custom build programming logic. In the implementation the Operator watches for a special resource which belongs to the deployment and management system and reconciles changes to that resource. It reconciles by updating the watched state of the resource to its’ own custom resource. There is also another controller which watches for the state of the custom resource and reconciliates the changes to it by sending a JSON-message to a configurable endpoint outside of the cluster. This was done so the custom data could be utilized in a monitoring system, but it also opens an opportunity to take advantage of this message in other systems as well, like Teams, Slack or even email.
The implementation was able to produce more observability to the set system. As a result the information was also very human readable and customizable. The prototype which was born during the proof of concept constructs an extensible platform to build other automated workflows’ on. It provides the basic ability to watch a set resource or a state in a particular type of resource and you can program any custom way to reconciliate the observed state. Based on the research an Operator is a very powerful tool for extending your Kubernetes cluster with custom logic or automation.