I can’t imagine deployment process of any modern application that wouldn’t be orchestrated by some kind of pipeline. It’s also the reason why I got into containers and Kubernetes/OpenShift in the first place – it enforces changes in your approach toward building and deploying but it makes up for with all these nice features that come with Kubernetes.Continue reading
Maintaining big Kubernetes environments with factories
People are fascinated by containers, Kubernetes and cloud native approach for different reasons. It could be enhanced security, real portability, greater extensibility or more resilience. For me personally, and for organizations delivering software products for their customers, there is one reason that is far more important – it’s the speed they can gain. That leads straight to decreased Time To Market, so highly appreciated and coveted by the business people, and even more job satisfaction for guys building application and platforms for them.
It starts with code
So how to speed it up? By leveraging this new technology and all the goodies that come with it. The real game-changer here is the way you can manage your platform, environments, and applications that run there. With Kubernetes based platforms you do it in a declarative manner which means you define your desired state and not particular steps leading to the implementation of it (like it’s done in imperative systems). That opens up a way to manage the whole system with code. Your primary job is to define your system state and let Kubernetes do its magic. You probably want to keep it in files in a versioned git repository (or repositories) and this article shows how you can build your platform by efficiently splitting up the code to multiple repositories.
Areas to manage
Since we can manage all the things from the code we could distinguish a few areas to delegate control over a code to different teams.
Let’s consider these three areas:
1. Platform
This is a part where all platform and cluster-wide configuration are defined. It affects all environments and their security. It can also include configuration for multiple clusters (e.g. when using OpenShift’s Machine Operator or Cluster API to install and manage clusters).
Examples of objects kept here:
- LimitRange, ResourceQuota
- NetworkPolicy, EgressNetworkPolicy
- ClusterRole, ClusterRoleBinding
- PersistentVolume – static pool
- MachineSet, Machine, MachineHealthCheck, Cluster
2. Environments (namespaces) management
Here we define how particular namespaces should be configured to run applications or services and at the same time keep it secure and under control.
Examples of objects kept here:
- ConfigMap, Secret
- Role, RoleBinding
3. CI/CD system
All other configuration that is specific to an application. Also, the pipeline definition is kept here with the details on how to build an application artifact from code, put it in a container image and push it to a container registry.
Examples of objects kept here:
- Jenkinsfile
- Jenkins shared library
- Tekton objects: Pipeline, PipelineRun, Task, ClusterTask, TaskRun, PipelineResource
- BuildConfig
- Deployment, Ingress, Service
- Helm Charts
- Kustomize overlays
Note that environment-specific configuration is kept elsewhere.
Factories
Our goal here is simple – leverage containers and Kubernetes features to quickly deliver applications to production environments and keep it all as code. To do so we can delegate the management of particular areas to special entities – let’s call them factories.
We can have two types of factories:
- Factory Building Environments (FBE) – responsible for maintaining objects from area 1 (platform).
- Factory Building Applications (FBA) – responsible for maintaining objects from area 2 (environments) and area 3 (CI/CD)
Factory Building Environments
First is a Factory Building Environments. In general, a single factory of this type is sufficient because it can maintain multiple environments and multiple clusters.
It exists for the following main reasons:
- To delegate control over critical objects (especially security-related) to a team of people responsible for platform stability and security
- To keep track of changes and protect global configuration that affects all the shared services and applications running on a cluster (or clusters)
- To ease management of multiple clusters and dozens (or even hundreds) of namespaces
Main tasks
So what kind of tasks does this factory is responsible for? Here are the most important ones.
Build and maintain shared images
There are a couple of container images that are used by many services inside your cluster and have a critical impact on platform security or stability. This could be in particular:
- a modified Fluentd container image
- a base image for all your java (or other types) applications with your custom CA added to a PKI configuration on a system level
- similarly – a custom s2i (Source to Image) builder
- a customized Jenkins Image with a predefined list of plugins and even seed jobs
Apply security and global configuration
This is actually the biggest and most important task of this factory. It should read a dedicated repository where all the files are kept and apply it to either at a cluster level or for a particular set of environments (namespaces).
Provide credentials
In some cases, this should also be a place where some credentials are configured in environments – for example, database credentials that shouldn’t be visible by developers or stored in an application repository.
Build other factories
Finally, this factory also builds other factories (FBA). This task includes creating new namespaces, maintaining their configuration and deploying required objects forming a new factory.
How to implement
FBE is just a concept that can be implemented in many ways. Here’s a list of possible solutions:
- The simplest case – a dedicated repository with restricted access, code review policy, and manual provisioning process.
- The previous solution can be extended with a proper hook attached to an event of merge of a pull request that will apply all changes automatically.
- As a part of git integration there can be a dedicated job on CI/CD server (e.g. Jenkins) that tracks a particular branch of the repo and also applies it automatically or on-demand.
- The last solution is the most advanced and also follows the best practices of cloud native approach. It is a dedicated operator that tracks the repository and applies it from inside a container. There could be different Custom Resources that would be responsible for different parts of configurations (e.g. configuration of namespace, global security settings of a cluster, etc.).
Factory Building Applications
The second type of factory is a factory building applications. It is designed to deliver applications to end-users to prod environments. It addresses the following challenges of delivery and deployment processes:
- Brings more autonomy for development teams who can use a dedicated set of namespaces for their delivery process
- Creates a safe place for experiments with preview environments created on-demand
- Ease the configuration process by reducing duplication of config files and providing default settings shared by applications and environments
- Enables grouping of applications/microservices under a single, manageable group of environments with shared settings and an aggregated view on deployment pipelines runs
- Separates configuration of Kubernetes objects from a global configuration (maintained by FBE) and application code to keep track of changes
Main tasks
Let’s have a look at the main tasks of this factory.
Build and deploy applications
The most important job is to build applications from a code, perform tests, put them in a container image and publish. When a new container image is ready it can be deployed to multiple environments that are managed by this factory. It is essentially the description of CI/CD tasks that are implemented here for a set of applications.
Provide common configuration for application and services
This factory should provide an easy way of creating a new environment for an application with a set of config files defining required resources (see examples of objects in area 2 and 3).
Namespace management
FBA manages two types of environments (namespaces):
- permanent environments – they are a part of CI/CD pipeline for a set of applications (or a single app) and their services
- preview environments – these are environments that are not a part of CI/CD pipeline but are created on-demand and used for different purposes (e.g. feature branch tests, performance tests, custom scenario tests, etc.)
It creates multiple preview environments and destroys them if they are no longer needed. For permanent environments, it ensures that they have a proper configuration but never deletes them (they are special and protected).
How to implement
Here are some implementation tips and more technical details.
- A factory can be created to maintain environments and CI/CD pipeline for a single application, however, often many applications are either developed by a single team or are a part of a single business domain and thus it is convenient to keep all the environments and processes around deployment in a single place.
- A factory consists of multiple namespaces, for example:
FN-cicd
– namespace where all build-related and delivery activities take place (FN
could be a factory name or some other prefix shared by namespaces managed by it)FN-test, FN-stage, FN-prod
– permanent environments- various number of preview environments
- Main tasks can be implemented by Jenkins running inside FN-cicd namespace and can be defined either by independent Jenkinsfiles or with jobs defined in a shared library configured on a Jenkins instance.
In OpenShift it’s even easier, as you can use BuildConfig objects of Pipeline type which will create proper jobs inside a Jenkins instance. - A dedicated operator seems to be again the best solution. It could be implemented as the same operator which maintains FBE with a set of Custom Resources for managing namespaces, pipelines and so on.
Summary
A couple of years ago, before docker and containers, I was a huge fan of Infrastructure as Code. With Kubernetes, operators, and thanks to its declarative nature, it is now possible to manage all the aspects of application building process, deployment, management of environments it would run in and even whole clusters deployed across multiple datacenters or clouds. Now it’s becoming increasingly important how are you handling the management of the code responsible for maintaining it. The idea of using multiple factories is helpful for organizations with many teams and applications and allows easy scaling of both and keeping it manageable at the same time.
Honest review of OpenShift 4
Czas introwertyków
Jestem introwertykiem. Jak wielu ludzi w IT. Często słyszę dowcip – “nie chcesz rozmawiać z ludźmi to idź na studia informatyczne” i chyba panuje takie ogólne przeświadczenie, że w branży IT jest nas najwięcej. Jest to jednak dalekie od prawdy, gdyż według wielu badań rozkład wychodzi mniej więcej po równo t.j. cechy introwertyczne i ekstrawertyczne rozkładają się równomiernie po całej populacji. I od razu obalmy pierwszy mit – nie jest prawdą, że się jest albo introwertykiem albo ekstrawertykiem. Ta cecha to spektrum – można być super-introwertykiem skrywającym się w samym sobie i można też być gdzieś po środku bliżej ekstrawertyka. Wówczas często określa się taką osobę jako ambiwertyka.
Czym jest ten introwertyzm?
Nie chcę tutaj przytaczać naukowych teorii – te łatwo znaleźć w sieci (np. wikipedia). Napiszę to z mojej własnej perspektywy i własnymi słowami.
Otóż jest to cecha, która określa w jakich sytuacjach gromadzisz energię a w jakich ją zużywasz. Dla nas introwertyków magazynujemy ją przebywając samotnie lub w bardzo małej grupie osób. I samotnie wcale nie oznacza na odosobnieniu. Chodzi bardziej o mentalnym przebywaniu z samym sobą, z własnymi myślami, odczuciami i refleksjami. Kierujemy uwagę do siebie – stąd określenie introwertyk.
Jak już ją zgromadzimy to możemy ją spożytkować na – uwaga – przebywanie z innymi, wdawać się w konwersacje i inne aktywności w grupie. Jestem żywym przykładem, że introwertyk może również występować publicznie czy prowadzić kilkudniowe szkolenia dla grupy osób, której wcześniej nie znał.
Ekstrawertycy mają lepiej?
Nawet introwertycy lubią ekstrawertyków. W końcu są to osoby, które często brylują w tłumie, często przewodzą zabawie, są duszą towarzystwa. Jako stworzenia socjalne potrzebujemy przynależności, powiązania z innymi i stąd wydaje nam się, że im większa grupa tym lepiej dla nas. Jak się okazuje nie dla wszystkich. Introwertycy również lubią grupy, ale mniejsze. I do tego nie do końca odpowiada im tzw. “small talk” i wolą poważniejsze rozmowy niż zaledwie płytką wymianę słów.
Niestety nasza kultura preferuje ekstrawertyczne zachowania. W końcu lepiej sprzedaje się kolejny show z celebrytami niż coś mniej wystrzałowego o głębszym przekazie. Wydaje się też nam, że tylko będąc osobą wystrzałową da się osiągnąć sukces. To jednak wielkie kłamstwo – w końcu introwertyczni ludzie sukcesu (i nie tylko) unikają rozgłosu i płytkich rozmów skupiając się na rzeczach ważniejszych.
Rewolucja informacyjna i nowy porządek
Wprowadzenie nowych technologii wywróciło dotychczasowy porządek. Odkąd otworzyły się nowe środki komunikacji i dzielenia się informacjami, obecna przewaga ekstrawertyków w udziale i kształtowaniu naszego świata. Introwertycy stoją w dużej mierze za tymi technologiami oraz jest ona dla nich sposobem na wyrażanie siebie. W końcu komunikacja mailowa pozwala przemyśleć co chcemy przekazać i sformułować lepiej nasze myśli przed faktycznym jej przekazaniem. Faktem jest, że takie sieci społecznościowe jak Instagram czy Facebook są opanowane w głównej mierze przez ekstrawertyczne osoby (część o dość narcystycznym usposobieniu i wykorzystujący je do budowania swojej własnej wartości na “lajkach”), ale czy wiesz kto zbudował te wszystkie wspaniałe portale? Tak, to w dużej mierze robota introwertyków. Ludzie, którzy często spędzają dużo czasu na rozmyślaniu, ale też na projektowaniu i tworzeniu nowej, wirtualnej rzeczywistości. Twórca Facebooka Mark Zuckeberk, twórca Microsoft Bill Gates czy też Linus Torvalds jako twórca Linuksa będącego fundamentem tworu znanego dzisiaj jako chmura publiczna. Oni wszyscy są introwertykami i stoją za jedynymi z największych rewolucji w świecie IT i nie tylko.
Obalamy mity o introwertykach
Poniżej kilka mitów krążących w społeczeństwie i będącego w sumie przykładem jak zachowania ekstrawertyczne są preferowane, a te introwertyczne kojarzone z cechami negatywnymi (podobnie jak inne, “odbiegające” od średniej jak niski wzrost, waga itp.).
Introwertycy zawsze siedzą przed komputerami i boją się ludzi
Kiedyś książki, a teraz komputery stały się ucieczką od ludzi, ale nie tylko dla introwertyków. I nie jest prawdą, że introwertycy wolą komputery. To fakt – komputery są bardziej przewidywalne, nie posiadają emocji i jeśli nie działają to dość sprawnie da się je naprawić lub wymienić.
Niemniej introwertycy również łakną kontaktów z ludźmi, ale przede wszystkim czują się lepiej w mniejszym gronie zaufanych przyjaciół. Wielkie bankiety to nie jest ich naturalne środowisko co nie oznacza, że nie potrafią się na nich odnaleźć. Z reguły będą starać się znaleźć mniejsze grono, w którym będą mogli prowadzić głębsze rozmowy niż tylko te na temat pogody. Szczególnie jeśli znajdą osoby znajome – zawieranie nowych znajomości trwa u nas po prostu dłużej.
Introwertycy nie umieją sprzedawać
Bzdura. Jeśli rozumiesz przez sprzedaż pewnego rodzaju akwizycję, tzw. “cold calling” czy też inne formy poszukiwania szybkiego kontaktu i natychmiastowego “zamknięcia” procesu to pewnie tak – niektórzy ekstrawertycy potrafią czarować i dokonać takich rzeczy.
Doskonale opisuje to Daniel Pink w książce “To sell is human” (polski tytuł to “Jak być dobrym sprzedawcą” – moim zdaniem zupełnie nietrafione i przeinaczające intencję autora tłumaczenie tytułu), gdzie pokazuje, że osoby gdzieś pośrodku spektrum sprawdzają się najlepiej – są to wspomniani na początku ambiwertycy.
Osobiście uważam, że dzisiaj sprzedażą może zająć się każdy. Obawiasz się kontaktu z innymi? Zawsze możesz schować to za automatem jak np. aukcja internetowa czy sklep z fajnym opisem. Nie jesteś super przebojowy, ale umiesz rozmawiać w małym gronie? To jak najbardziej możesz sprzedawać usługi i produkty. Jesteśmy przesyceni bzdurami i sztuczkami wyciągniętymi wprost z podręczników sprzedaży sprzed kilkudziesięciu lat. Ludzie autentyczni i empatyczny są w stanie osiągnąć o wiele więcej na dłuższą metę niż naśladowcy tych wspomnianych wzorców akwizycji.
Introwertycy to samotnicy z wyboru
To podobnie jak powiedzieć, że ekstrawertycy to ludzie żyjący tylko od imprezy do imprezy. Prawda jest taka, że ekstrawertycy ładują swoje “baterie” pośród ludzi, a energię tą zużywają będąc w małym gronie lub też samotnie. Introwertycy z kolei czerpią ją z przebywania z samym sobą i wykorzystują do wyjścia na zewnątrz, do większej grupy gdzie również nawiązują znajomości i prowadzą normalne życie towarzyskie. Nie jest ono pewnie w takiej skali i intensywności jak w przypadku ekstrawertyków i z pewnością nie zobaczysz wielu zdjęć na Instagramie, ale nie jest to w żadnym wypadku samotność.
Wystąpienia publiczne to domena ekstrawertyków
Skoro ładujemy te swoje baterie to występy publiczne mogą być tym miejscem, gdzie ta energia może być spożytkowana. I tak się dzieje chociażby w moim wypadku – chęć dzielenia się wiedzą, doświadczenia i inspirowania innych jest silniejsza oraz na tyle motywujące, że wyjście na scenę wygrywa z potrzebą poprzebywania z samym sobą. Nawet jeśli początki są trudne to jest to coś czego da się nauczyć niezależnie od typu osobowości. Możliwe, że ekstrawertycy mają ku temu lepsze predyspozycje (nie mam tego jak sprawdzić empirycznie niestety) to niekoniecznie wszyscy posiadają chęci rozwoju w tym kierunku.
Introwetyzm da się zmienić – trzeba więcej imprezować
Potrzeba zmiany swoich cech i postępowania jest istotnie możliwa, ale do pewnego stopnia. To z czym przychodzimy na świat jest częścią nas i jeśli w całości tego nie zaakceptujemy to staniemy się klientami wszelkiego rodzaju pseudo-coachów i programów rozwoju (piszę to jako osoba, które przeczytała sporo książek tego typu i uczestniczyła w paru warsztatach). Możesz się nauczyć technik, przełamywać naturalny strach i dążyć do swoich celów, ale twoje główne cechy będą zbliżone do tego co dostałeś, a nie tego kim chciałbyś być. Ten idealny obraz tworzony przez media kreuje ekstrawertyzm jako pożądaną cechę jakby to było podobne do bycia fit, gdzie kształtowanie ciała jest również ograniczone przez twoje predyspozycje.
Nie, nie zamienisz się w ekstrawertyka więcej imprezując, ale najwięcej uzyskasz wykorzystując to wszystko co jest z tym masz “w zestawie”.
Jak sprawdzić czy jestem introwertykiem?
Najprościej wybrać jeden z testów dostępnych za darmo w sieci. Może to być test 16 osobowości (znany też jako test Myersa-Briggsa) – na przykład ten.
Wykorzystaj swój czas
Nigdy nie było introwertykom tak łatwo pozostać sobą wykorzystując dzisiejszą technikę i swobodę jednocześnie osiągając swoje osobiste cele. Pomimo, że w społeczeństwie żywy jest obraz idealnej osoby ekstrawertycznej to warto iść swoją drogą. Nawet jeśli będzie to droga w mniejszym gronie, ale ludzi z którymi warto ją przemierzać.
How to increase container security with proper images
Security is a major factor when it comes to a decision of whether to invest your precious time and resources in new technology. It’s no different for containers and Kubernetes. I’ve heard a lot of concerns around it and decided to write about the most important factors that have the biggest impact on the security of systems based on containers running on Kubernetes.
This is particularly important, as it’s often the only impediment blocking potential implementation of container-based environment and also taking away chances for speeding up innovation. That’s when I decided to help all of you who wants strengthen security of their containers images.
Image size (and content) matters
The first factor is the size of a container image. It’s also a reason why container gained so much popularity – whole solutions, often quite complex are now consisting of multiple containers running from images available publicly on the web (mostly from Docker hub) that you can run in a few minutes.
In case your application running inside a container gets compromised and the attacker gets access to an environment with a shell, he needs to use his own tools and often it’s the first thing he does – he downloads them on the host. What if he can’t access tools that will enable him to do so? No scp, curl, wget, python or whatever he could use. That would make things harder or even impossible to make harm to your systems.
That is exactly why you need to keep your container images small and provide libraries and binaries that are really essential and used by the process running in a container.
Recommended practices
Use slim versions for base images
Since you want to keep your images small choose “fit” versions of base images. They are often called slim images and have less utils included. For example – the most popular base image is Debian and it’s standard version debian:jessie
weights 50MB while debian:jessie-slim
only 30MB. Besides less exciting doc files (list available here) it’s missing the following binaries
/bin/ip
/bin/ping
/bin/ping6
/bin/ss
/sbin/bridge
/sbin/rtacct
/sbin/rtmon
/sbin/tc
/usr/bin/lnstat
/usr/bin/nstat
/usr/bin/routef
/usr/bin/routel
/usr/sbin/arpd
They are mostly useful for network troubleshooting and I doubt if ping
is a deadly weapon. Still, the less binaries are present, the less potential files are available for an attacker that might use some kind of zero-day exploits in them.
Unfortunately, neither official Ubuntu nor CentOS don’t have slim versions. Looks like Debian is a much better choice, it contains maybe too many files but it’s very easy to fix – see below.
Delete unnecessary files
Do you need to install any packages from a running container? If you answered yes then you probably doing it wrong. Container images follow a simple unix philosophy – they should do one thing (and do it well) which is run a single app or service. Container images are immutable and thus any software should be installed during a container image build. Afterward, you don’t need it and you can disable it by deleting binaries used for that.
For Debian just put the following somewhere at the end of your Dockerfile
RUN rm /usr/bin/apt-* /usr/bin/dpkg*
Did you know that even without binaries you may still perform actions by using system calls? You can use any language interpreter like python, ruby or perl. It turns out that even slim version of Debian contains perl! Unless your app is developed in perl you can and should delete it
RUN /usr/bin/perl*
For other base images you may want to delete the following file categories:
Package management tools: yum, rpm, dpkg, apt
Any language interpreter that is unused by your app: ruby, perl, python, etc.
Utilities that can be used to download remote content: wget, curl, http, scp, rsync
Network connectivity tools: ssh, telnet, rsh
Separate building from embedding
For languages that need compiling (e.g. java, golang) it’s better to decouple building application artifact from building a container image. If you use the same image for building and running your container, it will be very large as development tools have many dependencies and not only they will enlarge your final image but also download binaries that could be used by an attacker.
If you’re migrating your app to container environment you probably already have some kind of CI/CD process or at least you build your artifacts on Jenkins or other server. You can leverage this existing process and add a step that will copy the artifact into the app image.
For full container-only build you can use multistage build feature. Notice however that it works only with newer version of Docker (17.05 and above) and it doesn’t work with OpenShift. On OpenShift there is similar feature called chained builds, but it’s more complicated to use.
Consider the development of statically compiled apps
Want to have the most secure container image? Put a single file in it. That’s it. Currently, the easiest way to accomplish that is by developing it in golang. Easier said than done, but consider it for your future projects and also prefer vendors that are able to deliver software written in go. As long it doesn’t compromise quality and other factors (e.g. delivery time, cost) it definitely increases security.
Maintaining secure images
There are three types of container images you use:
- Base images
- Services (a.k.a. COTS – Common off-the-shelf)
- Your applications
Base images aren’t used to run containers – they provide the first layer with all necessary files and utilities
For services you don’t need to build anything – you just run them and provide your configuration and a place to store data.
Application images are built by you and thus require a base image on top of which you build your final image.
Of course, both services and applications are built on top of a base image and thus their security depends largely depends on its quality.
We can distinguish the following factors that have the biggest impact on container image security:
- The time it takes to publish a new image with fixes for vulnerabilities found in its packages (binaries, libraries)
- Existence of a dedicated security team that tracks vulnerabilities and publish advisories
- Support for automatic scanning tools which often needs access to security database with published fixes
- Proven track of handling major vulnerabilities in the past
In a case where there are many applications built in an organization, an intermediary image is built and maintained that is used as a base image for all the applications. It is used to primarily to provide common settings, additional files (e.g. company’s certificate authority) or tighten security. In other words – it is used to standardize and enforce security in all applications used throughout the organization.
Now we know how important it is to choose a secure base image. However, for service images, we rely on a choice made by a vendor or an image creator. Sometimes they publish multiple editions of the image. In most cases it is based on some Debian/Ubuntu and additionally on Alpine (like redis, RabbitMQ, Postgres).
Doubts around Alpine
And what about alpine? Personally, I’m not convinced it’s a good idea to use it in production. I mean there are many unexpected and strange behaviors and I just don’t find it good enough for a reliable, production environment. Lack of security advisories, a single repo maintained by a single person is not the best recommendation. I know that many have trusted this tiny, Linux distribution that is supposed to be “Small. Simple. Secure.”. I’m using it for many demos, training and testing but still, it hasn’t convinced me to be as good as good old Debian, Ubuntu, CentOS or maybe even
Oraclelinux.
And just recently they had a major vulnerability discovered – an empty password for user root was set in most of their images. Check if your images use the affected version and fix it ASAP.
Recommended practices
Trust but verify
As I mentioned before there sometimes official images don’t offer the best quality and that’s why it’s better to verify them as a part of CI/CD pipeline.
Here are some tools you should consider:
Anchore (opensource and commercial)
Clair (opensource)
Openscap (opensource)
Twistlock (commercial)
jFrog Xray (commercial)
Aquasec (commercial)
Use them wisely, also to check your currently running containers – often critical vulnerabilities are found and waiting for next deployment can cause a serious security risk.
Use vendor provided images
For service images, it is recommended to use images provided by a vendor. They are available as so-called “official images”. The main advantage is that not only they are updated when a vulnerability is found in the software but also in an underlying OS layer. Think twice before choosing a non-official image or building one yourself. It’s just a waste of your time. If you really need to customize beyond providing configuration, you have at least two ways to achieve it:
For smaller changer you can override entrypoint
with your script that modifies some small parts; script itself can be mounted from a configmap.
Here’s a Kubernetes snippet of a spec for a sample nginx service with a script mounted from nginx-entrypoint
ConfigMap
spec:
containers:
- name: mynginx
image: mynginx:1.0
command: ["/ep/entrypoint.sh"]
volumeMounts:
- name: entrypoint-volume
mountPath: /ep/
volumes:
- name: entrypoint-volume
configMap:
name: nginx-entrypoint
For bigger changes, you may want to create your image based on the official one and rebuild it when a new version is released
Use good quality base images
Most official images available on Docker Hub are based on Debian. I even did a small research on this a couple of years ago (it is available here) and for some reason, Ubuntu is not the most popular distribution. So if you like Debian you can feel safe and join the others who also chose it. It’s a distribution with a mature ecosystem around
If you prefer rpm-based systems (or for some reasons your software requires it) then I would avoid CentOS and consider Red Hat Enterprise Linux images. With RHEL 8, Red Hat released Universal Base Image (UBI) that can be used freely without any fees. I just trust more those guys, as they invest a lot of resources in containers recently and these new UBI images should be updated frequently by their security team.
Avoid building custom base images
Just don’t. Unless your paranoia level is close to extreme, you can reuse images like Debian, Ubuntu or UBI described earlier. On the other hand, if you’re really paranoid I don’t think you trust anyone, including guys who brought us containers and Kubernetes as well.
Auto-rebuild application and intermediary images when vulnerabilities are found in a base image
In the old, legacy vm-based world the process of fixing vulnerabilities found in a system is called patching. Similar practice takes place in container-based world but in its specific form. Instead of fixing it on the fly, you need to replace the whole image with your app. The best way to achieve it is by creating an automated process that will rebuild it and even trigger a deployment. I found OpenShift ImageStreams feature to address this problem in the best way (details can be found in my article), but it’s not available on vanilla Kubernetes.
Conclusion
We switched from fairly static virtual machines to dynamic, ephemeral containers with the same challenges – how to keep them secure. In this part, we have covered the steps required to address them on the container image level. I always say that container technology enforces the new way of handling things we used to accomplish in rather manual (e.g. golden images, vm templates), error-prone processes. When migrating to containers you need to embrace an automatic and declarative style of managing your environments, including security-related activities. Leverage that to tighten security of your systems starting with basics – choosing and maintaining your container images.
Three levels of highly available apps on Kubernetes
Beautiful but useless systems
Hundreds of applications, thousands of users and millions of requests – that is often a landscape of a modern IT environment. However, problems are still the same. Continue reading
Shamans in organizations – who are they and why are they dangerous
Imagine for a while that your organization is like a village where there are regular residents and shamans who keep most of the knowledge for themselves. This is a story about them and why it is dangerous, how to manage it and prevent from reaching your goals and causing harm to other residents.Continue reading
Why managing container images on OpenShift is better than on Kubernetes
So you’ve decided to go with Kubernetes and started building your container images. Now the question is where to push them and how to manage them properly?Continue reading
Hamulce innowacji w Polsce
Lepiej nie było nigdy
Podobno żyjemy w najbezpieczniejszych czasach – brak wojen od kilkudziesięciu lat, brak poważniejszych epidemii, względny spokój i dobrobyt.
Byli, są i będą ciągle narzekający – ważne jednak nie dać się wciągnąć w ten wir czarnowidztwa (polskie “z kim się zadajesz, takim się stajesz” lub naukowe podejścia dotyczące średniej z 5 ludzi ciebie otaczających).
Jednocześnie te dobrodziejstwa przybliżyły wszystkim (no dobra – wszystkim z dostępem do jakiegokolwiek komputera i internetu, czyli ~80-90% ludzi w Polsce?) dostęp do wiedzy. Teraz jak nigdy wystarczy chcieć. Chcieć i zacząć działać. Nigdy nie było to prostsze, naprawdę!
I mamy rok 2018, a ja mam wrażenie, że w dużej części organizacji, niezależnie czy sektora publicznego czy prywatnego, wciąż niewiele się zmieniło. No dobra – są fajniejsze komputery niż 10 czy 15 lat temu, są fajniejsze narzędzia, szybszy internet (zdjęcia z Pudelka ładują się szybciej i to pewnie w 4K!). Baaa – wielu ludzi posiadło wiedzę na temat wprowadzania nowych metod usprawniających organizację pracy – wszechobecny Scrum, standupy, Kanbany i Leany.
Hamulce
Zatem co obecnie blokuje innowację w dziedzinie IT w Polsce? Co powoduje, że część ludzi wybiera karierę na zachodzie nie widząc perspektyw rozwoju w kraju? Oto co według mnie jest głównymi hamulcami.
Stara gwardia, stare przyzwyczajenia
Poprzez “stare” nie mam na myśli wieku. Są ludzie młodsi ode mnie, którzy osiągnęli naprawdę wiele, ciągle się rozwijają, widzą potrzebę usprawniania, posiadają energię i ciężko pracują. Są też ludzie blisko emerytury, którzy mimo, że ich młodość przypadła na czasy, gdy telewizor kolorowy był czymś “na wypasie” to i tak są w stanie zauważyć zmiany, a dzięki swojemu doświadczeniu odróżnić co jest ważne, a co nie. Z drugiej strony znam takich, którzy niezależnie od wieku tkwią w miejscu, w swoich przekonaniach, niezmienności i niemalże są dumni z tego.
I nie – to nie jest tak, że kiedyś to były lepsze, mniej zawodne samochody, jedzenie zdrowsze, a ludzie bardziej życzliwi. Psychologia to wyjaśnia (np. tutaj), ale dla mnie jest to po prostu ucieczka i kolejna próba usprawiedliwiania. Szukania wymówek, lenistwa itp.
Dla odmiany jedne z najbardziej wartościowych książek powstały faktycznie dawno (chociażby “Medytacje” Marka Aureliusza), a co za tym idzie były dostępne dla wielu ludzi podobnie jak dostęp do technologii dzisiaj..
Strach i perfekcjonizm
Ileż to razy słyszałem przy wprowadzaniu zmiany, że powinniśmy wziąć pod uwagę to i tamto, aby zrobić to raz a dobrze. Jasne – jak byśmy budowali most, dom to ok, ale nie przy IT! Tutaj zwinność jest dodawana do nazwy każdego nowego produktu (kurcze – może niektórzy nie sprawdzili co oznacza “Agile”?) jest absurdem. Nie zmieni tego wprowadzenie Scruma, “wdrożenie DevOpsa” czy migracja aplikacji na mikroserwisy. To zakamuflowany perfekcjonizm tkwiący w nas, wpajany od przedszkola, utrwalany w szkołach i egzekwowany w organizacjach. Bo jak popełnisz błąd to najwidoczniej jesteś niedostatecznie dobry (“w końcu nie po to ci tyle płacimy w tym IT?”). A co powie jeszcze szef twojego szefa? A co jeśli dojdzie to do kierownictwa z dalekiego kraju? Musi być dobrze. Od razu. I najgorsze, że sami nawzajem to w sobie utrwalamy prześcigając się w znajdowaniu wad rozwiązań – kto więcej ten lepszy. Przyznaję się, że sam nauczony przez lata również często łapię się na uczestnictwo w tej rywalizacji. Smutne, ale prawdziwe. Dlatego o ile jestem wielkim zwolennikiem metod zwinnych i metody małych kroków to nie wierzę, że jest to do osiągnięcia bez zmiany sposobu myślenia – wszakże nawet realizując małe części większego projektu możemy być ograniczeni myśleniem o doprowadzeniu wszystkiego na raz przez uwagę na potencjalną krytykę.
Brak zaufania
Podstawa budowania dobrych zespołów (przynajmniej według Patricka Lencioniego i jego “Pięć dysfunkcji pracy zespołu”) to zaufanie. Jak możesz powierzyć komuś w pełni zadanie jednocześnie pilnując go za każdym razem, sprawdzając i mikrozarządzając? Nie możesz, tylko udajesz i w dużej mierze wykorzystujesz tylko swoją pozycję w uwielbianej przez polaków hierarchii służbowej. Być może to wciąż zalegające w podświadomości naszych dziadków i rodziców przyzwyczajenia z epoki, gdzie ostrożność była cnotą ze względu na opresyjny charakter ustroju, w którym przyszło im żyć. Nie mi tu dochodzić przyczyn, ale fakt jest taki, że wciąż zbyt często doświadczam ograniczonego lub zupełnego braku zaufania. To jest coś czego wciąż się musimy nauczyć, bo nie możemy zmienić tego co było, ale z pewnością mamy wpływ na to co będzie.
Nadzieja
Na szczęście spotykam też grupy osób, które nauczone (same, przez dobre otoczenie lub na bazie doświadczeń i refleksji) innego sposobu myślenia i działania. To z nimi właśnie warto “góry przenosić”, pchać do przodu i jednocześnie zmagać się wspólnie z tymi, których wartości takie są dalekie oraz jakże obce. Oby więcej tych pierwszych niż tych drugich na naszej zawodowej (i nie tylko) ścieżce!
Dlaczego utworzyłem kurs Kubernetes po polsku
Udostępniam właśnie pierwsze odcinki mojego kursu z Kubernetes. A tutaj opisuję dlaczego to robię.