A pod is the basic building block of OpenShift applications. A
pod can contain one or more containers along with other information, like environment variables, volumes, and more. If you're familiar with
pod is largely equivalent to a
A simple pod to start up a database service might look like this:
--- apiVersion: v1 kind: Pod metadata: name: mariadb spec: containers: - name: mariadb image: mariadb:10-bionic imagePullPolicy: IfNotPresent env: - name: MYSQL_ROOT_PASSWORD value: root_secret ports: - containerPort: 3306 protocol: TCP restartPolicy: Always
In practice, your deployments will probably be substantially more complex. Some changes we would want to make:
We would want to create a service to act as a front-end for Mariadb. This would allow us to associate a with the service in order to provide external access to the database.
We would probably want to mount a volume on
/var/lib/mysqlso that our data persists outside of the container filesystem.
We probably want to use OpenShift secrets to provide the value of
A deployment is a higher-level construct that includes rules for creating multiple replicas of a service (useful if you have an application that can scale out horizontally).
A template (such as your example from earlier) is an even higher-level construct for describing "a set of objects that can be parameterized and processed to produce a list of objects (secrets, services, pods, etc) for creation by OpenShift".