diff --git a/docs/openshift/configuration/config-map/index.md b/docs/openshift/configuration/config-map/index.md index b387f88..1910746 100644 --- a/docs/openshift/configuration/config-map/index.md +++ b/docs/openshift/configuration/config-map/index.md @@ -3,6 +3,7 @@ ConfigMaps allow you to decouple configuration artifacts from image content to keep containerized applications portable. You can data from a ConfigMap in 3 different ways. + - As a single environment variable specific to a single key - As a set of environment variables from all keys - As a set of files, each key represented by a file on mounted volume @@ -11,11 +12,11 @@ You can data from a ConfigMap in 3 different ways. === "OpenShift" - [Mapping Volumes :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/nodes/containers/nodes-containers-projected-volumes.html){ .md-button target="_blank"} + [Mapping Volumes :fontawesome-solid-map:](https://docs.openshift.com/container-platform/4.13/nodes/containers/nodes-containers-projected-volumes.html){ .md-button target="_blank"} === "Kubernetes" - [ConfigMaps :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/){ .md-button target="_blank"} + [ConfigMaps :fontawesome-solid-map:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/){ .md-button target="_blank"} ## References @@ -23,10 +24,10 @@ You can data from a ConfigMap in 3 different ways. apiVersion: v1 kind: ConfigMap metadata: - name: my-cm + name: my-cm data: - color: blue - location: naboo + color: blue + location: naboo ``` ```yaml @@ -89,4 +90,4 @@ spec: - configMapRef: name: my-cm restartPolicy: Never -``` \ No newline at end of file +``` diff --git a/docs/openshift/configuration/index.md b/docs/openshift/configuration/index.md index 45752cd..b23bf98 100644 --- a/docs/openshift/configuration/index.md +++ b/docs/openshift/configuration/index.md @@ -6,9 +6,9 @@ When you create a Pod, you can define a command and arguments for the containers The command and arguments that you define in the configuration file override the default command and arguments provided by the container image -Dockerfile vs Kubernetes -Dockerfile Entrypoint -> k8s command -Dockerfile CMD -> k8s args +- Dockerfile vs Kubernetes +- Dockerfile Entrypoint -> k8s command +- Dockerfile CMD -> k8s args ### Ports @@ -24,11 +24,11 @@ A Pod can use environment variables to expose information about itself to Contai === "OpenShift & Kubernetes" - [Container Commands :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/){ .md-button target="_blank"} + [Container Commands :fontawesome-solid-gear:](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/){ .md-button target="_blank"} - [Environment Variables :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/){ .md-button target="_blank"} + [Environment Variables :fontawesome-solid-gear:](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/){ .md-button target="_blank"} - [Pod Exposing :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#exposing-pods-to-the-cluster){ .md-button target="_blank"} + [Pod Exposing :fontawesome-solid-gear:](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#exposing-pods-to-the-cluster){ .md-button target="_blank"} ### References @@ -39,9 +39,9 @@ metadata: name: my-cmd-pod spec: containers: - - name: myapp-container - image: busybox - command: ['echo'] + - name: myapp-container + image: busybox + command: ["echo"] restartPolicy: Never ``` @@ -52,10 +52,10 @@ metadata: name: my-arg-pod spec: containers: - - name: myapp-container - image: busybox - command: ['echo'] - args: ['Hello World'] + - name: myapp-container + image: busybox + command: ["echo"] + args: ["Hello World"] restartPolicy: Never ``` @@ -66,10 +66,10 @@ metadata: name: my-port-pod spec: containers: - - name: myapp-container - image: bitnami/nginx - ports: - - containerPort: 8080 + - name: myapp-container + image: bitnami/nginx + ports: + - containerPort: 8080 ``` ```yaml @@ -80,13 +80,13 @@ metadata: spec: restartPolicy: Never containers: - - name: c - image: busybox - env: - - name: DEMO_GREETING - value: "Hello from the environment" - command: ["echo"] - args: ["$(DEMO_GREETING)"] + - name: c + image: busybox + env: + - name: DEMO_GREETING + value: "Hello from the environment" + command: ["echo"] + args: ["$(DEMO_GREETING)"] ``` ```yaml @@ -131,9 +131,9 @@ CPU and memory are each a resource type. A resource type has a base unit. CPU is === "OpenShift & Kubernetes" - [Compute Resources :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container){ .md-button target="_blank"} + [Compute Resources :fontawesome-solid-screwdriver-wrench:](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container){ .md-button target="_blank"} - [Memory Management :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/){ .md-button target="_blank"} + [Memory Management :fontawesome-solid-screwdriver-wrench:](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/){ .md-button target="_blank"} ### References @@ -144,21 +144,21 @@ metadata: name: my-pod spec: containers: - - name: my-app - image: bitnami/nginx - ports: - - containerPort: 8080 - resources: - requests: - memory: "64Mi" - cpu: "250m" - limits: - memory: "128Mi" - cpu: "500m" + - name: my-app + image: bitnami/nginx + ports: + - containerPort: 8080 + resources: + requests: + memory: "64Mi" + cpu: "250m" + limits: + memory: "128Mi" + cpu: "500m" ``` +_Namespaced defaults mem_ -Namespaced defaults mem ```yaml apiVersion: v1 kind: LimitRange @@ -166,14 +166,15 @@ metadata: name: mem-limit-range spec: limits: - - default: - memory: 512Mi - defaultRequest: - memory: 256Mi - type: Container + - default: + memory: 512Mi + defaultRequest: + memory: 256Mi + type: Container ``` -Namespaced defaults mem +_Namespaced defaults mem_ + ```yaml apiVersion: v1 kind: LimitRange @@ -181,16 +182,16 @@ metadata: name: cpu-limit-range spec: limits: - - default: - cpu: 1 - defaultRequest: - cpu: 0.5 - type: Container + - default: + cpu: 1 + defaultRequest: + cpu: 0.5 + type: Container ``` ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | | -| Pod Configuration | Configure a pod to meet compute resource requirements. | [Pod Configuration](../../labs/kubernetes/lab2/index.md) | +| Task | Description | Link | +| --------------------- | ------------------------------------------------------ | :------------------------------------------------------- | +| **_Try It Yourself_** | | | +| Pod Configuration | Configure a pod to meet compute resource requirements. | [Pod Configuration](../../labs/kubernetes/lab2/index.md) | diff --git a/docs/openshift/configuration/secrets/index.md b/docs/openshift/configuration/secrets/index.md index 2daf209..f4f8b08 100644 --- a/docs/openshift/configuration/secrets/index.md +++ b/docs/openshift/configuration/secrets/index.md @@ -4,7 +4,6 @@ Kubernetes secret objects let you store and manage sensitive information, such a A Secret is an object that contains a small amount of sensitive data such as a password, a token, or a key. Such information might otherwise be put in a Pod specification or in an image; putting it in a Secret object allows for more control over how it is used, and reduces the risk of accidental exposure. - ## Resources === "OpenShift" @@ -30,15 +29,15 @@ A Secret is an object that contains a small amount of sensitive data such as a p - [Image Pull Secrets :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/openshift_images/managing_images/using-image-pull-secrets.html){ .md-button target="_blank"} + [Image Pull Secrets :fontawesome-solid-key:](https://docs.openshift.com/container-platform/4.13/openshift_images/managing_images/using-image-pull-secrets.html){ .md-button target="_blank"} - [Secret Commands :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/cli_reference/openshift_cli/developer-cli-commands.html#oc-create-secret-generic){ .md-button target="_blank"} + [Secret Commands :fontawesome-solid-key:](https://docs.openshift.com/container-platform/4.13/cli_reference/openshift_cli/developer-cli-commands.html#oc-create-secret-generic){ .md-button target="_blank"} === "Kubernetes" - [Secrets :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/configuration/secret/){ .md-button target="_blank"} + [Secrets :fontawesome-solid-key:](https://kubernetes.io/docs/concepts/configuration/secret/){ .md-button target="_blank"} - [Secret Distribution :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/){ .md-button target="_blank"} + [Secret Distribution :fontawesome-solid-key:](https://kubernetes.io/docs/tasks/inject-data-application/distribute-credentials-secure/){ .md-button target="_blank"} ## References @@ -74,22 +73,22 @@ metadata: name: my-pod spec: containers: - - name: my-app - image: bitnami/nginx - ports: - - containerPort: 8080 - env: - - name: SECRET_USERNAME - valueFrom: - secretKeyRef: + - name: my-app + image: bitnami/nginx + ports: + - containerPort: 8080 + env: + - name: SECRET_USERNAME + valueFrom: + secretKeyRef: + name: mysecret + key: username + envFrom: + - secretRef: name: mysecret - key: username - envFrom: - - secretRef: - name: mysecret - volumeMounts: - - name: config - mountPath: "/etc/secrets" + volumeMounts: + - name: config + mountPath: "/etc/secrets" volumes: - name: config secret: @@ -97,39 +96,31 @@ spec: ``` === "OpenShift" - **Create files needed for rest of example.** - ``` - echo -n 'admin' > ./username.txt +**Create files needed for rest of example.** +` echo -n 'admin' > ./username.txt echo -n '1f2d1e2e67df' > ./password.txt - ``` - **Creating Secret from files.** - ``` - oc create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt - ``` - **Getting Secret** - ``` - oc get secrets - ``` - **Gets the Secret's Description.** - ``` - oc describe secrets/db-user-pass - ``` + ` +**Creating Secret from files.** +` oc create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt + ` +**Getting Secret** +` oc get secrets + ` +**Gets the Secret's Description.** +` oc describe secrets/db-user-pass + ` === "Kubernetes" - **Create files needed for rest of example.** - ``` - echo -n 'admin' > ./username.txt +**Create files needed for rest of example** +` echo -n 'admin' > ./username.txt echo -n '1f2d1e2e67df' > ./password.txt - ``` - ** Creates the Secret from the files** - ``` - kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt - ``` - **Gets the Secret** - ``` - kubectl get secrets - ``` - **Gets the Secret's Description.** - ``` - kubectl describe secrets/db-user-pass - ``` \ No newline at end of file + ` +**Creates the Secret from the files** +` kubectl create secret generic db-user-pass --from-file=./username.txt --from-file=./password.txt + ` +**Gets the Secret** +` kubectl get secrets + ` +**Gets the Secret's Description** +` kubectl describe secrets/db-user-pass + ` diff --git a/docs/openshift/configuration/security-contexts/index.md b/docs/openshift/configuration/security-contexts/index.md index 95609d1..a173450 100644 --- a/docs/openshift/configuration/security-contexts/index.md +++ b/docs/openshift/configuration/security-contexts/index.md @@ -8,22 +8,24 @@ To specify security settings for a Pod, include the securityContext field in the === "OpenShift" - [Managing Security Contexts :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/authentication/managing-security-context-constraints.html){ .md-button target="_blank"} + [Managing Security Contexts :fontawesome-solid-shield-halved:](https://docs.openshift.com/container-platform/4.13/authentication/managing-security-context-constraints.html){ .md-button target="_blank"} === "Kubernetes" - [Security Contexts :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/){ .md-button target="_blank"} - + [Security Contexts :fontawesome-solid-shield-halved:](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/){ .md-button target="_blank"} ## References Setup minikube VM with users + ``` minikube ssh ``` + ``` su - ``` + ``` echo "container-user-0:x:2000:2000:-:/home/container-user-0:/bin/bash" >> /etc/passwd echo "container-user-1:x:2001:2001:-:/home/container-user-1:/bin/bash" >> /etc/passwd @@ -35,8 +37,8 @@ chown 2000:3000 /etc/message/message.txt chmod 640 /etc/message/message.txt ``` - Using the this `securityContext` the container will be able to read the file `/message/message.txt` + ```yaml apiVersion: v1 kind: Pod @@ -62,6 +64,7 @@ spec: ``` Using the this `securityContext` the container should NOT be able to read the file `/message/message.txt` + ```yaml apiVersion: v1 kind: Pod @@ -85,7 +88,8 @@ spec: hostPath: path: /etc/message ``` -** Run to see the errors ** + +**Run to see the errors** === "OpenShift" @@ -105,4 +109,4 @@ spec: ``` Bash title="Should return" cat: can't open '/message/message.txt': Permission denied - ``` \ No newline at end of file + ``` diff --git a/docs/openshift/configuration/service-accounts/index.md b/docs/openshift/configuration/service-accounts/index.md index 661eb54..e850864 100644 --- a/docs/openshift/configuration/service-accounts/index.md +++ b/docs/openshift/configuration/service-accounts/index.md @@ -12,15 +12,15 @@ User accounts are intended to be global. Names must be unique across all namespa === "OpenShift" - [Service Accounts :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/authentication/understanding-and-creating-service-accounts.html){ .md-button target="_blank"} + [Service Accounts :fontawesome-solid-id-card:](https://docs.openshift.com/container-platform/4.13/authentication/understanding-and-creating-service-accounts.html){ .md-button target="_blank"} - [Using Service Accounts :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/authentication/using-service-accounts-in-applications.html){ .md-button target="_blank"} + [Using Service Accounts :fontawesome-solid-id-card:](https://docs.openshift.com/container-platform/4.13/authentication/using-service-accounts-in-applications.html){ .md-button target="_blank"} === "Kubernetes" - [Service Accounts :fontawesome-solid-globe:](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/){ .md-button target="_blank"} + [Service Accounts :fontawesome-solid-id-card:](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/){ .md-button target="_blank"} - [Service Account Configuration :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/){ .md-button target="_blank"} + [Service Account Configuration :fontawesome-solid-id-card:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/){ .md-button target="_blank"} ## References @@ -39,10 +39,10 @@ metadata: spec: serviceAccountName: my-service-account containers: - - name: my-app - image: bitnami/nginx - ports: - - containerPort: 8080 + - name: my-app + image: bitnami/nginx + ports: + - containerPort: 8080 ``` ```yaml @@ -73,4 +73,4 @@ type: kubernetes.io/service-account-token ``` Bash title="View Service Account Details" kubectl describe sa - ``` \ No newline at end of file + ``` diff --git a/docs/openshift/deployments/index.md b/docs/openshift/deployments/index.md index 1c50fff..682411f 100644 --- a/docs/openshift/deployments/index.md +++ b/docs/openshift/deployments/index.md @@ -5,6 +5,7 @@ A Deployment provides declarative updates for Pods and ReplicaSets. You describe a desired state in a Deployment, and the Deployment Controller changes the actual state to the desired state at a controlled rate. You can define Deployments to create new ReplicaSets, or to remove existing Deployments and adopt all their resources with new Deployments. The following are typical use cases for Deployments: + - Create a Deployment to rollout a ReplicaSet. The ReplicaSet creates Pods in the background. Check the status of the rollout to see if it succeeds or not. - Declare the new state of the Pods by updating the PodTemplateSpec of the Deployment. A new ReplicaSet is created and the Deployment manages moving the Pods from the old ReplicaSet to the new one at a controlled rate. Each new ReplicaSet updates the revision of the Deployment. - Rollback to an earlier Deployment revision if the current state of the Deployment is not stable. Each rollback updates the revision of the Deployment. @@ -13,24 +14,23 @@ The following are typical use cases for Deployments: - Use the status of the Deployment as an indicator that a rollout has stuck. - Clean up older ReplicaSets that you don’t need anymore. - ## Resources === "OpenShift" - [Deployments :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/applications/deployments/what-deployments-are.html){ .md-button target="_blank"} + [Deployments :fontawesome-solid-cloud-arrow-up:](https://docs.openshift.com/container-platform/4.13/applications/deployments/what-deployments-are.html){ .md-button target="_blank"} - [Managing Deployment Processes :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/applications/deployments/managing-deployment-processes.html){ .md-button target="_blank"} + [Managing Deployment Processes :fontawesome-solid-cloud-arrow-up:](https://docs.openshift.com/container-platform/4.13/applications/deployments/managing-deployment-processes.html){ .md-button target="_blank"} - [DeploymentConfig Strategies :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/applications/deployments/deployment-strategies.html){ .md-button target="_blank"} + [DeploymentConfig Strategies :fontawesome-solid-cloud-arrow-up:](https://docs.openshift.com/container-platform/4.13/applications/deployments/deployment-strategies.html){ .md-button target="_blank"} - [Route Based Deployment Strategies :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/applications/deployments/route-based-deployment-strategies.html){ .md-button target="_blank"} + [Route Based Deployment Strategies :fontawesome-solid-cloud-arrow-up:](https://docs.openshift.com/container-platform/4.13/applications/deployments/route-based-deployment-strategies.html){ .md-button target="_blank"} === "Kubernetes" - [Deployments :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/){ .md-button target="_blank"} + [Deployments :fontawesome-solid-cloud-arrow-up:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/){ .md-button target="_blank"} - [Scaling Deployments :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#scaling-a-deployment){ .md-button target="_blank"} + [Scaling Deployments :fontawesome-solid-cloud-arrow-up:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#scaling-a-deployment){ .md-button target="_blank"} ## References @@ -52,10 +52,10 @@ spec: app: nginx spec: containers: - - name: nginx - image: bitnami/nginx:1.16.0 - ports: - - containerPort: 8080 + - name: nginx + image: bitnami/nginx:1.16.0 + ports: + - containerPort: 8080 ``` === "Openshift" @@ -112,7 +112,7 @@ spec: ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | | -| Rolling Updates Lab | Create a Rolling Update for your application | [Rolling Updates](../../labs/kubernetes/lab6/index.md) | \ No newline at end of file +| Task | Description | Link | +| --------------------- | -------------------------------------------- | :----------------------------------------------------- | +| **_Try It Yourself_** | | | +| Rolling Updates Lab | Create a Rolling Update for your application | [Rolling Updates](../../labs/kubernetes/lab6/index.md) | diff --git a/docs/openshift/deployments/updates/index.md b/docs/openshift/deployments/updates/index.md index ee4d6a2..d59e715 100644 --- a/docs/openshift/deployments/updates/index.md +++ b/docs/openshift/deployments/updates/index.md @@ -17,16 +17,15 @@ A Deployment’s revision is created when a Deployment’s rollout is triggered. === "OpenShift" - [Rollouts :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/applications/deployments/what-deployments-are.html#delpoymentconfigs-specific-features_what-deployments-are){ .md-button target="_blank"} + [Rollouts :fontawesome-solid-rotate-right:](https://docs.openshift.com/container-platform/4.13/applications/deployments/what-deployments-are.html#delpoymentconfigs-specific-features_what-deployments-are){ .md-button target="_blank"} - [Rolling Back :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/applications/deployments/managing-deployment-processes.html#deployments-rolling-back_deployment-operations){ .md-button target="_blank"} + [Rolling Back :fontawesome-solid-rotate-left:](https://docs.openshift.com/container-platform/4.13/applications/deployments/managing-deployment-processes.html#deployments-rolling-back_deployment-operations){ .md-button target="_blank"} === "Kubernetes" - [Updating a Deployment :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment){ .md-button target="_blank"} - - [Rolling Back a Deployment :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-back-a-deployment){ .md-button target="_blank"} + [Updating a Deployment :fontawesome-solid-rotate-right:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#updating-a-deployment){ .md-button target="_blank"} + [Rolling Back a Deployment :fontawesome-solid-rotate-left:](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-back-a-deployment){ .md-button target="_blank"} ## References @@ -48,10 +47,10 @@ spec: app: nginx spec: containers: - - name: nginx - image: bitnami/nginx:1.16.0 - ports: - - containerPort: 8080 + - name: nginx + image: bitnami/nginx:1.16.0 + ports: + - containerPort: 8080 ``` === "OpenShift" @@ -100,4 +99,4 @@ spec: ``` Bash title="Setting Namespace in Context" kubectl config set-context --current --namespace=dev - ``` \ No newline at end of file + ``` diff --git a/docs/openshift/pods/health-checks/index.md b/docs/openshift/pods/health-checks/index.md index 4ce5ac0..8044772 100644 --- a/docs/openshift/pods/health-checks/index.md +++ b/docs/openshift/pods/health-checks/index.md @@ -4,31 +4,31 @@ A Probe is a diagnostic performed periodically by the kubelet on a Container. To perform a diagnostic, the kubelet calls a Handler implemented by the Container. There are three types of handlers: -***ExecAction***: Executes a specified command inside the Container. The diagnostic is considered successful if the command exits with a status code of 0. +**_ExecAction_**: Executes a specified command inside the Container. The diagnostic is considered successful if the command exits with a status code of 0. -***TCPSocketAction***: Performs a TCP check against the Container’s IP address on a specified port. The diagnostic is considered successful if the port is open. +**_TCPSocketAction_**: Performs a TCP check against the Container’s IP address on a specified port. The diagnostic is considered successful if the port is open. -***HTTPGetAction***: Performs an HTTP Get request against the Container’s IP address on a specified port and path. The diagnostic is considered successful if the response has a status code greater than or equal to 200 and less than 400. +**_HTTPGetAction_**: Performs an HTTP Get request against the Container’s IP address on a specified port and path. The diagnostic is considered successful if the response has a status code greater than or equal to 200 and less than 400. The kubelet can optionally perform and react to three kinds of probes on running Containers: -***livenessProbe***: Indicates whether the Container is running. Runs for the lifetime of the Container. +**_livenessProbe_**: Indicates whether the Container is running. Runs for the lifetime of the Container. -***readinessProbe***: Indicates whether the Container is ready to service requests. Only runs at start. +**_readinessProbe_**: Indicates whether the Container is ready to service requests. Only runs at start. ### Resources === "OpenShift" - [Application Health :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.14/applications/application-health.html){ .md-button target="_blank"} + [Application Health :fontawesome-solid-heart-pulse:](https://docs.openshift.com/container-platform/4.14/applications/application-health.html){ .md-button target="_blank"} - [Virtual Machine Health :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.14/virt/logging_events_monitoring/virt-monitoring-vm-health.html){ .md-button target="_blank"} + [Virtual Machine Health :fontawesome-solid-heart-pulse:](https://docs.openshift.com/container-platform/4.14/virt/logging_events_monitoring/virt-monitoring-vm-health.html){ .md-button target="_blank"} === "Kubernetes" - [Container Probes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes){ .md-button target="_blank"} + [Container Probes :fontawesome-solid-heart-pulse:](https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes){ .md-button target="_blank"} - [Configure Probes :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/){ .md-button target="_blank"} + [Configure Probes :fontawesome-solid-heart-pulse:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/){ .md-button target="_blank"} ### References @@ -39,12 +39,12 @@ metadata: name: my-pod spec: containers: - - name: app - image: busybox - command: ['sh', '-c', "echo Hello, Kubernetes! && sleep 3600"] - livenessProbe: - exec: - command: ['echo','alive'] + - name: app + image: busybox + command: ["sh", "-c", "echo Hello, Kubernetes! && sleep 3600"] + livenessProbe: + exec: + command: ["echo", "alive"] ``` ```yaml @@ -55,19 +55,19 @@ metadata: spec: shareProcessNamespace: true containers: - - name: app - image: bitnami/nginx - ports: - - containerPort: 8080 - livenessProbe: - tcpSocket: - port: 8080 - initialDelaySeconds: 10 - readinessProbe: - httpGet: - path: / - port: 8080 - periodSeconds: 10 + - name: app + image: bitnami/nginx + ports: + - containerPort: 8080 + livenessProbe: + tcpSocket: + port: 8080 + initialDelaySeconds: 10 + readinessProbe: + httpGet: + path: / + port: 8080 + periodSeconds: 10 ``` ## Container Logging @@ -78,18 +78,19 @@ Kubernetes provides no native storage solution for log data, but you can integra ### Resources -**OpenShift** +=== "OpenShift" -- [Logs Command](https://docs.openshift.com/container-platform/4.13/cli_reference/openshift_cli/developer-cli-commands.html){:target="_blank"} -- [Cluster Logging](https://docs.openshift.com/container-platform/4.13/logging/cluster-logging.html){:target="_blank"} -- [Logging Collector](https://docs.openshift.com/container-platform/4.13/logging/config/cluster-logging-collector.html){:target="_blank"} + [Logs Command :fontawesome-solid-file-lines:](https://docs.openshift.com/container-platform/4.13/cli_reference/openshift_cli/developer-cli-commands.html){ .md-button target="_blank"} -**IKS** + [Cluster Logging :fontawesome-solid-file-lines:](https://docs.openshift.com/container-platform/4.13/logging/cluster-logging.html){ .md-button target="_blank"} -- [Logging](https://kubernetes.io/docs/concepts/cluster-administration/logging/){:target="_blank"} + [Logging Collector :fontawesome-solid-file-lines:](https://docs.openshift.com/container-platform/4.13/logging/config/cluster-logging-collector.html){ .md-button target="_blank"} -### References +=== "Kubernetes" + [Logging :fontawesome-solid-file-lines:](https://kubernetes.io/docs/concepts/cluster-administration/logging/){ .md-button target="_blank"} + +### References ```yaml title="Pod Example" apiVersion: v1 @@ -98,9 +99,14 @@ metadata: name: counter spec: containers: - - name: count - image: busybox - command: ['sh','-c','i=0; while true; do echo "$i: $(date)"; i=$((i+1)); sleep 5; done'] + - name: count + image: busybox + command: + [ + "sh", + "-c", + 'i=0; while true; do echo "$i: $(date)"; i=$((i+1)); sleep 5; done', + ] ``` === "OpenShift" @@ -133,14 +139,15 @@ Prometheus, a CNCF project, can natively monitor Kubernetes, nodes, and Promethe ### Resources -**OpenShift** +=== "OpenShift" + + [Monitoring Application Health :fontawesome-brands-watchman-monitoring:](https://docs.openshift.com/container-platform/4.13/applications/application-health.html){ .md-button target="_blank"} -- [Monitoring Application Health](https://docs.openshift.com/container-platform/4.13/applications/application-health.html){:target="_blank"} +=== "Kubernetes" -**IKS** + [Monitoring Resource Usage :fontawesome-brands-watchman-monitoring:](https://kubernetes.io/docs/tasks/debug-application-cluster/resource-usage-monitoring/){ .md-button target="_blank"} -- [Monitoring Resource Usage](https://kubernetes.io/docs/tasks/debug-application-cluster/resource-usage-monitoring/){:target="_blank"} -- [Resource Metrics](https://kubernetes.io/docs/tasks/debug-application-cluster/resource-metrics-pipeline/){:target="_blank"} + [Resource Metrics :fontawesome-brands-watchman-monitoring:](https://kubernetes.io/docs/tasks/debug-application-cluster/resource-metrics-pipeline/){ .md-button target="_blank"} ### References @@ -151,15 +158,20 @@ metadata: name: 500m spec: containers: - - name: app - image: gcr.io/kubernetes-e2e-test-images/resource-consumer:1.4 - resources: - requests: - cpu: 700m - memory: 128Mi - - name: busybox-sidecar - image: radial/busyboxplus:curl - command: [/bin/sh, -c, 'until curl localhost:8080/ConsumeCPU -d "millicores=500&durationSec=3600"; do sleep 5; done && sleep 3700'] + - name: app + image: gcr.io/kubernetes-e2e-test-images/resource-consumer:1.4 + resources: + requests: + cpu: 700m + memory: 128Mi + - name: busybox-sidecar + image: radial/busyboxplus:curl + command: + [ + /bin/sh, + -c, + 'until curl localhost:8080/ConsumeCPU -d "millicores=500&durationSec=3600"; do sleep 5; done && sleep 3700', + ] ``` ```yaml @@ -169,22 +181,28 @@ metadata: name: 200m spec: containers: - - name: app - image: gcr.io/kubernetes-e2e-test-images/resource-consumer:1.4 - resources: - requests: - cpu: 300m - memory: 64Mi - - name: busybox-sidecar - image: radial/busyboxplus:curl - command: [/bin/sh, -c, 'until curl localhost:8080/ConsumeCPU -d "millicores=200&durationSec=3600"; do sleep 5; done && sleep 3700'] + - name: app + image: gcr.io/kubernetes-e2e-test-images/resource-consumer:1.4 + resources: + requests: + cpu: 300m + memory: 64Mi + - name: busybox-sidecar + image: radial/busyboxplus:curl + command: + [ + /bin/sh, + -c, + 'until curl localhost:8080/ConsumeCPU -d "millicores=200&durationSec=3600"; do sleep 5; done && sleep 3700', + ] ``` === "OpenShift" - ``` - oc get projects - oc api-resources -o wide - oc api-resources -o name + +```` +oc get projects +oc api-resources -o wide +oc api-resources -o name oc get nodes,ns,po,deploy,svc @@ -215,7 +233,8 @@ spec: ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| ***Try It Yourself*** | | | -| Probes | Create some Health & Startup Probes to find what's causing an issue. | [Probes](../../../labs/kubernetes/lab4/index.md) | +| Task | Description | Link | +| --------------------- | -------------------------------------------------------------------- | :----------------------------------------------- | +| **_Try It Yourself_** | | | +| Probes | Create some Health & Startup Probes to find what's causing an issue. | [Probes](../../../labs/kubernetes/lab4/index.md) | +```` diff --git a/docs/openshift/pods/jobs/index.md b/docs/openshift/pods/jobs/index.md index 7aa36d9..0e0a9d0 100644 --- a/docs/openshift/pods/jobs/index.md +++ b/docs/openshift/pods/jobs/index.md @@ -1,28 +1,32 @@ # Jobs and CronJobs **Jobs** -A Job creates one or more Pods and ensures that a specified number of them successfully terminate. As pods successfully complete, the Job tracks the successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete. Deleting a Job will clean up the Pods it created. +A Job creates one or more Pods and ensures that a specified number of them successfully terminate. As pods successfully complete, the Job tracks the successful completions. When a specified number of successful completions is reached, the task (ie, Job) is complete. Deleting a Job will clean up the Pods it created. **CronJobs** + One CronJob object is like one line of a crontab (cron table) file. It runs a job periodically on a given schedule, written in Cron format. All CronJob schedule: times are based on the timezone of the master where the job is initiated. ## Resources -**OpenShift** -- [Jobs](https://docs.openshift.com/container-platform/4.3/nodes/jobs/nodes-nodes-jobs.html) -- [CronJobs](https://docs.openshift.com/container-platform/4.3/nodes/jobs/nodes-nodes-jobs.html#nodes-nodes-jobs-creating-cron_nodes-nodes-jobs) +=== "OpenShift" + + [Jobs :fontawesome-solid-briefcase:](https://docs.openshift.com/container-platform/4.3/nodes/jobs/nodes-nodes-jobs.html){ .md-button target="_blank"} + [CronJobs :fontawesome-solid-briefcase:](https://docs.openshift.com/container-platform/4.3/nodes/jobs/nodes-nodes-jobs.html#nodes-nodes-jobs-creating-cron_nodes-nodes-jobs){ .md-button target="_blank"} + +=== "Kubernetes" -**IKS** -- [Jobs to Completion](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/) -- [Cron Jobs](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/) -- [Automated Tasks with Cron](https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/) + [Jobs to Completion :fontawesome-solid-briefcase:](https://kubernetes.io/docs/concepts/workloads/controllers/jobs-run-to-completion/){ .md-button target="_blank"} + [Cron Jobs :fontawesome-solid-briefcase:](https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/){ .md-button target="_blank"} + [Automated Tasks with Cron :fontawesome-solid-briefcase:](https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/){ .md-button target="_blank"} ## References -It computes π to 2000 places and prints it out +_It computes π to 2000 places and prints it out_ + ```yaml apiVersion: batch/v1 kind: Job @@ -32,14 +36,15 @@ spec: template: spec: containers: - - name: pi - image: perl - command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] + - name: pi + image: perl + command: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"] restartPolicy: Never backoffLimit: 4 ``` -Running in parallel +_Running in parallel_ + ```yaml apiVersion: batch/v1 kind: Job @@ -70,12 +75,12 @@ spec: template: spec: containers: - - name: hello - image: busybox - args: - - /bin/sh - - -c - - date; echo Hello from the Kubernetes cluster + - name: hello + image: busybox + args: + - /bin/sh + - -c + - date; echo Hello from the Kubernetes cluster restartPolicy: OnFailure ``` @@ -151,8 +156,8 @@ spec: ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| ***Try It Yourself*** | | | -| Rolling Updates Lab | Create a Rolling Update for your application. | [Rolling Updates](../../../labs/kubernetes/lab6/index.md) | -| Cron Jobs Lab | Using Tekton to test new versions of applications. | [Crons Jobs](../../../labs/kubernetes/lab7/index.md) | +| Task | Description | Link | +| --------------------- | -------------------------------------------------- | :-------------------------------------------------------- | +| **_Try It Yourself_** | | | +| Rolling Updates Lab | Create a Rolling Update for your application. | [Rolling Updates](../../../labs/kubernetes/lab6/index.md) | +| Cron Jobs Lab | Using Tekton to test new versions of applications. | [Crons Jobs](../../../labs/kubernetes/lab7/index.md) | diff --git a/docs/openshift/pods/multi-container/index.md b/docs/openshift/pods/multi-container/index.md index 9af423c..a610f90 100644 --- a/docs/openshift/pods/multi-container/index.md +++ b/docs/openshift/pods/multi-container/index.md @@ -1,18 +1,18 @@ # Multi-Containers Pod -Container images solve many real-world problems with existing packaging and deployment tools, but in addition to these significant benefits, containers offer us an opportunity to fundamentally re-think the way we build distributed applications. Just as service oriented architectures (SOA) encouraged the decomposition of applications into modular, focused services, containers should encourage the further decomposition of these services into closely cooperating modular containers. By virtue of establishing a boundary, containers enable users to build their services using modular, reusable components, and this in turn leads to services that are more reliable, more scalable and faster to build than applications built from monolithic containers. +Container images solve many real-world problems with existing packaging and deployment tools, but in addition to these significant benefits, containers offer us an opportunity to fundamentally re-think the way we build distributed applications. Just as service oriented architectures (SOA) encouraged the decomposition of applications into modular, focused services, containers should encourage the further decomposition of these services into closely cooperating modular containers. By virtue of establishing a boundary, containers enable users to build their services using modular, reusable components, and this in turn leads to services that are more reliable, more scalable and faster to build than applications built from monolithic containers. ## Resources === "Kubernetes" - [Sidecar Logging :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/cluster-administration/logging/#using-a-sidecar-container-with-the-logging-agent){.md-button target="_blank"} + [Sidecar Logging :fontawesome-solid-bxoes-stacked:](https://kubernetes.io/docs/concepts/cluster-administration/logging/#using-a-sidecar-container-with-the-logging-agent){.md-button target="_blank"} - [Shared Volume Communication :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/){.md-button target="_blank"} + [Shared Volume Communication :fontawesome-solid-boxes-stacked:](https://kubernetes.io/docs/tasks/access-application-cluster/communicate-containers-same-pod-shared-volume/){.md-button target="_blank"} - [Toolkit Patterns :fontawesome-solid-globe:](https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/){.md-button target="_blank"} - - [Brendan Burns Paper :fontawesome-solid-globe:](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45406.pdf){.md-button target="_blank"} + [Toolkit Patterns :fontawesome-solid-boxes-stacked:](https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/){.md-button target="_blank"} + + [Brendan Burns Paper :fontawesome-solid-boxes-stacked:](https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/45406.pdf){.md-button target="_blank"} ## References @@ -23,22 +23,27 @@ metadata: name: my-pod spec: volumes: - - name: shared-data - emptyDir: {} - containers: - - name: app - image: bitnami/nginx - volumeMounts: - - name: shared-data - mountPath: /app - ports: - - containerPort: 8080 - - name: sidecard - image: busybox - volumeMounts: - name: shared-data - mountPath: /pod-data - command: ['sh', '-c', 'echo Hello from the side container > /pod-data/index.html && sleep 3600'] + emptyDir: {} + containers: + - name: app + image: bitnami/nginx + volumeMounts: + - name: shared-data + mountPath: /app + ports: + - containerPort: 8080 + - name: sidecard + image: busybox + volumeMounts: + - name: shared-data + mountPath: /pod-data + command: + [ + "sh", + "-c", + "echo Hello from the side container > /pod-data/index.html && sleep 3600", + ] ``` ```yaml @@ -49,18 +54,18 @@ metadata: spec: shareProcessNamespace: true containers: - - name: app - image: bitnami/nginx - ports: - - containerPort: 8080 - - name: sidecard - image: busybox - securityContext: - capabilities: - add: - - SYS_PTRACE - stdin: true - tty: true + - name: app + image: bitnami/nginx + ports: + - containerPort: 8080 + - name: sidecard + image: busybox + securityContext: + capabilities: + add: + - SYS_PTRACE + stdin: true + tty: true ``` === "OpenShift" @@ -97,7 +102,7 @@ spec: ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| ***Try It Yourself*** | | | -| Multiple Containers | Build a container using legacy container image.| [Multiple Containers](../../../labs/kubernetes/lab3/index.md) | +| Task | Description | Link | +| --------------------- | ----------------------------------------------- | :------------------------------------------------------------ | +| **_Try It Yourself_** | | | +| Multiple Containers | Build a container using legacy container image. | [Multiple Containers](../../../labs/kubernetes/lab3/index.md) | diff --git a/docs/openshift/pods/tagging/index.md b/docs/openshift/pods/tagging/index.md index d6ea225..7b44f5d 100644 --- a/docs/openshift/pods/tagging/index.md +++ b/docs/openshift/pods/tagging/index.md @@ -10,14 +10,13 @@ You can use either labels or annotations to attach metadata to Kubernetes object === "OpenShift" - [CLI Label Commands :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/cli_reference/openshift_cli/developer-cli-commands.html){.md-button target="_blank"} + [CLI Label Commands :fontawesome-solid-tags:](https://docs.openshift.com/container-platform/4.13/cli_reference/openshift_cli/developer-cli-commands.html){.md-button target="_blank"} === "Kubernetes" - [Labels :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/){.md-button target="_blank"} - - [Annotations :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/){.md-button target="_blank"} + [Labels :fontawesome-solid-tags:](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/){.md-button target="_blank"} + [Annotations :fontawesome-solid-tags:](https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/){.md-button target="_blank"} ## References @@ -35,8 +34,8 @@ metadata: gitrepo: "https://github.com/csantanapr/knative" spec: containers: - - name: app - image: bitnami/nginx + - name: app + image: bitnami/nginx ``` === "OpenShift" @@ -109,4 +108,4 @@ spec: **Delete the Pod.** ``` kubectl delete pod my-pod - ``` \ No newline at end of file + ``` diff --git a/docs/openshift/pods/troubleshooting/index.md b/docs/openshift/pods/troubleshooting/index.md index 3019ec2..a6a9374 100644 --- a/docs/openshift/pods/troubleshooting/index.md +++ b/docs/openshift/pods/troubleshooting/index.md @@ -8,138 +8,101 @@ Usually is getting familiar with how primitives objects interact with each other === "OpenShift" - [Debugging with ODO :fontawesome-solid-globe:](https://odo.dev/docs/user-guides/advanced/debugging-with-openshift-toolkit){.md-button target="_blank"} + [Debugging with ODO :fontawesome-solid-bug:](https://odo.dev/docs/user-guides/advanced/debugging-with-openshift-toolkit){.md-button target="_blank"} === "Kubernetes" - [Debugging Applications :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-application/){.md-button target="_blank"} + [Debugging Applications :fontawesome-solid-bug:](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-application/){.md-button target="_blank"} - [Debugging Services :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/){.md-button target="_blank"} - - [Debugging Replication Controllers :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-pod-replication-controller/){.md-button target="_blank"} + [Debugging Services :fontawesome-solid-bug:](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-service/){.md-button target="_blank"} + [Debugging Replication Controllers :fontawesome-solid-bug:](https://kubernetes.io/docs/tasks/debug-application-cluster/debug-pod-replication-controller/){.md-button target="_blank"} ## References === "OpenShift" - ** MacOS/Linux/Windows command: ** - ```bash +**MacOS/Linux/Windows command:** +`bash oc apply -f https://gist.githubusercontent.com/csantanapr/e823b1bfab24186a26ae4f9ec1ff6091/raw/1e2a0cca964c7b54ce3df2fc3fbf33a232511877/debugk8s-bad.yaml - ``` - - ** Expose the service using port-forward ** - ``` - oc port-forward service/my-service 8080:80 -n debug - ``` - ** Try to access the service ** - ``` - curl http://localhost:8080 - ``` - - ** Try Out these Commands to Debug ** - ``` - oc get pods --all-namespaces - ``` - ``` - oc project debug - ``` - ``` - oc get deployments - ``` - ``` - oc describe pod - ``` - ``` - oc explain Pod.spec.containers.resources.requests - ``` - ``` - oc explain Pod.spec.containers.livenessProbe - ``` - ``` - oc edit deployment - ``` - ``` - oc logs - ``` - ``` - oc get service - ``` - ``` - oc get ep - ``` - ``` - oc describe service - ``` - ``` - oc get pods --show-labels - ``` - ``` - oc get deployment --show-labels - ``` + ` +**Expose the service using port-forward** +` oc port-forward service/my-service 8080:80 -n debug + ` +**Try to access the service** +` curl http://localhost:8080 + ` +**Try Out these Commands to Debug** +` oc get pods --all-namespaces + ` +` oc project debug + ` +` oc get deployments + ` +` oc describe pod + ` +` oc explain Pod.spec.containers.resources.requests + ` +` oc explain Pod.spec.containers.livenessProbe + ` +` oc edit deployment + ` +` oc logs + ` +` oc get service + ` +` oc get ep + ` +` oc describe service + ` +` oc get pods --show-labels + ` +` oc get deployment --show-labels + ` === "Kubernetes" - - ** MacOS/Linux/Windows command: ** - ```bash +**MacOS/Linux/Windows command:** +`bash kubectl apply -f https://gist.githubusercontent.com/csantanapr/e823b1bfab24186a26ae4f9ec1ff6091/raw/1e2a0cca964c7b54ce3df2fc3fbf33a232511877/debugk8s-bad.yaml - ``` - - ** Expose the service using port-forward ** - ``` - kubectl port-forward service/my-service 8080:80 -n debug - ``` - ** Try to access the service ** - ``` - curl http://localhost:8080 - ``` - - ** Try Out these Commands to Debug ** - ``` - kubectl get pods --all-namespaces - ``` - ``` - kubectl config set-context --current --namespace=debug - ``` - ``` - kubectl get deployments - ``` - ``` - kubectl describe pod - ``` - ``` - kubectl explain Pod.spec.containers.resources.requests - ``` - ``` - kubectl explain Pod.spec.containers.livenessProbe - ``` - ``` - kubectl edit deployment - ``` - ``` - kubectl logs - ``` - ``` - kubectl get service - ``` - ``` - kubectl get ep - ``` - ``` - kubectl describe service - ``` - ``` - kubectl get pods --show-labels - ``` - ``` - kubectl get deployment --show-labels - ``` - + ` +**Expose the service using port-forward** +` kubectl port-forward service/my-service 8080:80 -n debug + ` +**Try to access the service** +` curl http://localhost:8080 + ` +**Try Out these Commands to Debug** +` kubectl get pods --all-namespaces + ` +` kubectl config set-context --current --namespace=debug + ` +` kubectl get deployments + ` +` kubectl describe pod + ` +` kubectl explain Pod.spec.containers.resources.requests + ` +` kubectl explain Pod.spec.containers.livenessProbe + ` +` kubectl edit deployment + ` +` kubectl logs + ` +` kubectl get service + ` +` kubectl get ep + ` +` kubectl describe service + ` +` kubectl get pods --show-labels + ` +` kubectl get deployment --show-labels + ` ## Activities The continuous integration activities focus around Tekton the integration platform. These labs will show you how to build pipelines and test your code before deployment. -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | | -| Debugging | Find which service is breaking in your cluster and find out why. | [Debugging](../../../labs/kubernetes/lab5/index.md) | 30 min | +| Task | Description | Link | Est. Time | +| --------------------- | ---------------------------------------------------------------- | :-------------------------------------------------- | --------- | +| **_Try It Yourself_** | | | +| Debugging | Find which service is breaking in your cluster and find out why. | [Debugging](../../../labs/kubernetes/lab5/index.md) | 30 min | diff --git a/docs/openshift/services-networking/index.md b/docs/openshift/services-networking/index.md index 51a2a6e..7d5807a 100644 --- a/docs/openshift/services-networking/index.md +++ b/docs/openshift/services-networking/index.md @@ -12,14 +12,13 @@ If you’re able to use Kubernetes APIs for service discovery in your applicatio For non-native applications, Kubernetes offers ways to place a network port or load balancer in between your application and the backend Pods. - ## Resources === "OpenShift & Kubernetes" - [Services :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/services-networking/service/){ .md-button target="_blank"} + [Services :fontawesome-solid-wrench:](https://kubernetes.io/docs/concepts/services-networking/service/){ .md-button target="_blank"} - [Exposing Services :fontawesome-solid-globe:](https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/){ .md-button target="_blank"} + [Exposing Services :fontawesome-solid-wrench:](https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/){ .md-button target="_blank"} ## References @@ -43,11 +42,11 @@ spec: version: v1 spec: containers: - - name: nginx - image: bitnami/nginx - ports: - - containerPort: 8080 - name: http + - name: nginx + image: bitnami/nginx + ports: + - containerPort: 8080 + name: http --- apiVersion: v1 kind: Service @@ -61,6 +60,7 @@ spec: port: 80 targetPort: http ``` + === "OpenShift" ```Bash title="Get Logs" @@ -84,6 +84,7 @@ spec: ``` ``` + ``` === "OpenShift" @@ -124,8 +125,8 @@ spec: ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | | -| Creating Services | Create two services with certain requirements. | [Setting up Services](../../labs/kubernetes/lab8/index.md) | -| IKS Ingress Controller | Configure Ingress on Free IKS Cluster | [Setting IKS Ingress](../../labs/kubernetes/ingress-iks/index.md) | +| Task | Description | Link | +| ---------------------- | ---------------------------------------------- | :---------------------------------------------------------------- | +| **_Try It Yourself_** | | | +| Creating Services | Create two services with certain requirements. | [Setting up Services](../../labs/kubernetes/lab8/index.md) | +| IKS Ingress Controller | Configure Ingress on Free IKS Cluster | [Setting IKS Ingress](../../labs/kubernetes/ingress-iks/index.md) | diff --git a/docs/openshift/services-networking/ingress.md b/docs/openshift/services-networking/ingress.md index 6cf50dd..5a53f87 100644 --- a/docs/openshift/services-networking/ingress.md +++ b/docs/openshift/services-networking/ingress.md @@ -10,17 +10,17 @@ Ingress exposes HTTP and HTTPS routes from outside the cluster to services withi === "OpenShift" - [Ingress Operator :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/networking/ingress-operator.html){ .md-button target="_blank"} + [Ingress Operator :fontawesome-solid-door-open:](https://docs.openshift.com/container-platform/4.13/networking/ingress-operator.html){ .md-button target="_blank"} - [Using Ingress Controllers :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.html){ .md-button target="_blank"} + [Using Ingress Controllers :fontawesome-solid-door-open:](https://docs.openshift.com/container-platform/4.13/networking/configuring_ingress_cluster_traffic/configuring-ingress-cluster-traffic-ingress-controller.html){ .md-button target="_blank"} === "Kubernetes" - [Ingress :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/services-networking/ingress/){ .md-button target="_blank"} + [Ingress :fontawesome-solid-door-open:](https://kubernetes.io/docs/concepts/services-networking/ingress/){ .md-button target="_blank"} - [Ingress Controllers :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/){ .md-button target="_blank"} + [Ingress Controllers :fontawesome-solid-door-open:](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/){ .md-button target="_blank"} - [Minikube Ingress :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/){ .md-button target="_blank"} + [Minikube Ingress :fontawesome-solid-door-open:](https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/){ .md-button target="_blank"} ## References @@ -31,14 +31,15 @@ metadata: name: example-ingress spec: rules: - - host: hello-world.info - http: - paths: - - path: / - backend: - serviceName: web - servicePort: 8080 + - host: hello-world.info + http: + paths: + - path: / + backend: + serviceName: web + servicePort: 8080 ``` + === "OpenShift" ``` Bash title="View Ingress Status" @@ -75,7 +76,7 @@ spec: ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | | -| IKS Ingress Controller | Configure Ingress on Free IKS Cluster | [Setting IKS Ingress](../../labs/kubernetes/ingress-iks/index.md) | \ No newline at end of file +| Task | Description | Link | +| ---------------------- | ------------------------------------- | :---------------------------------------------------------------- | +| **_Try It Yourself_** | | | +| IKS Ingress Controller | Configure Ingress on Free IKS Cluster | [Setting IKS Ingress](../../labs/kubernetes/ingress-iks/index.md) | diff --git a/docs/openshift/services-networking/routes.md b/docs/openshift/services-networking/routes.md index 8738709..cd64c21 100644 --- a/docs/openshift/services-networking/routes.md +++ b/docs/openshift/services-networking/routes.md @@ -1,8 +1,8 @@ # Routes -(OpenShift Only) +**_OpenShift Only_** -Routes are Openshift objects that expose services for external clients to reach them by name. +Routes are Openshift objects that expose services for external clients to reach them by name. Routes can insecured or secured on creation using certificates. @@ -12,15 +12,16 @@ The new route inherits the name from the service unless you specify one using th === "OpenShift" - [Routes :fontawesome-solid-globe:](https://docs.openshift.com/online/pro/dev_guide/routes.html){ .md-button target="_blank"} + [Routes :fontawesome-solid-route:](https://docs.openshift.com/online/pro/dev_guide/routes.html){ .md-button target="_blank"} - [Route Configuration :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/networking/routes/route-configuration.html){ .md-button target="_blank"} + [Route Configuration :fontawesome-solid-route:](https://docs.openshift.com/container-platform/4.13/networking/routes/route-configuration.html){ .md-button target="_blank"} - [Secured Routes :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/networking/routes/secured-routes.html){ .md-button target="_blank"} + [Secured Routes :fontawesome-solid-route:](https://docs.openshift.com/container-platform/4.13/networking/routes/secured-routes.html){ .md-button target="_blank"} ## References -** Route Creation ** +**_Route Creation_** + ``` apiVersion: v1 kind: Route @@ -31,7 +32,9 @@ spec: kind: Service name: frontend ``` -** Secured Route Creation ** + +**_Secured Route Creation_** + ``` apiVersion: v1 kind: Route @@ -46,6 +49,7 @@ spec: ``` ## Commands + === "OpenShift" ``` Bash title="Create Route from YAML" @@ -62,4 +66,4 @@ spec: ``` Bash title="Get Route YAML" oc get route -o yaml - ``` \ No newline at end of file + ``` diff --git a/docs/openshift/services-networking/services.md b/docs/openshift/services-networking/services.md index 5b69590..a452c0b 100644 --- a/docs/openshift/services-networking/services.md +++ b/docs/openshift/services-networking/services.md @@ -12,14 +12,13 @@ If you’re able to use Kubernetes APIs for service discovery in your applicatio For non-native applications, Kubernetes offers ways to place a network port or load balancer in between your application and the backend Pods. - ## Resources === "OpenShift & Kubernetes" - [Services :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/services-networking/service/){ .md-button target="_blank"} + [Services :fontawesome-solid-wrench:](https://kubernetes.io/docs/concepts/services-networking/service/){ .md-button target="_blank"} - [Exposing Services :fontawesome-solid-globe:](https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/){ .md-button target="_blank"} + [Exposing Services :fontawesome-solid-wrench:](https://kubernetes.io/docs/tutorials/kubernetes-basics/expose/expose-intro/){ .md-button target="_blank"} ## References @@ -43,11 +42,11 @@ spec: version: v1 spec: containers: - - name: nginx - image: bitnami/nginx - ports: - - containerPort: 8080 - name: http + - name: nginx + image: bitnami/nginx + ports: + - containerPort: 8080 + name: http --- apiVersion: v1 kind: Service @@ -61,6 +60,7 @@ spec: port: 80 targetPort: http ``` + === "OpenShift" ```Bash title="Get Logs" @@ -84,6 +84,7 @@ spec: ``` ``` + ``` === "OpenShift" @@ -124,7 +125,7 @@ spec: ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | | -| Creating Services | Create two services with certain requirements. | [Setting up Services](../../labs/kubernetes/lab8/index.md) | +| Task | Description | Link | +| --------------------- | ---------------------------------------------- | :--------------------------------------------------------- | +| **_Try It Yourself_** | | | +| Creating Services | Create two services with certain requirements. | [Setting up Services](../../labs/kubernetes/lab8/index.md) | diff --git a/docs/openshift/state-persistence/index.md b/docs/openshift/state-persistence/index.md index 80fd0cb..ce47e81 100644 --- a/docs/openshift/state-persistence/index.md +++ b/docs/openshift/state-persistence/index.md @@ -1,15 +1,16 @@ # State Persistence -State persistence in the context of Kubernetes/OpenShift refers to the ability to maintain and retain the state or data of applications even when they are stopped, restarted, or moved between nodes. This is achieved through the use of volumes, persistent volumes (PVs), and persistent volume claims (PVCs). Volumes provide a way to store and access data in a container, while PVs serve as the underlying storage resources provisioned by the cluster. PVCs act as requests made by applications for specific storage resources from the available PVs. By utilizing PVs and PVCs, applications can ensure that their state is preserved and accessible across pod restarts and migrations, enabling reliable and consistent data storage and retrieval throughout the cluster. +State persistence in the context of Kubernetes/OpenShift refers to the ability to maintain and retain the state or data of applications even when they are stopped, restarted, or moved between nodes. -## Resources +This is achieved through the use of volumes, persistent volumes (PVs), and persistent volume claims (PVCs). **Volumes** provide a way to store and access data in a container, while **PVs** serve as the underlying storage resources provisioned by the cluster. **PVCs** act as requests made by applications for specific storage resources from the available PVs. By utilizing PVs and PVCs, applications can ensure that their state is preserved and accessible across pod restarts and migrations, enabling reliable and consistent data storage and retrieval throughout the cluster. +## Resources -[Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"} +[Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="\_blank"} -[Persistent Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"} +[Persistent Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="\_blank"} -[Persistent Volume Claims :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims){ .md-button target="_blank"} +[Persistent Volume Claims :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#persistentvolumeclaims){ .md-button target="\_blank"} ## References @@ -25,16 +26,15 @@ spec: requests: storage: 1Gi ``` -In this example, we define a PVC named my-pvc with the following specifications: -accessModes specify that the volume can be mounted as read-write by a single node at a time (ReadWriteOnce). -resources.requests.storage specifies the requested storage size for the PVC (1Gi). +In this example, we define a PVC named _my-pvc_ with the following specifications: +- _accessModes_ specify that the volume can be mounted as read-write by a single node at a time ("ReadWriteOnce") +- _resources.requests.storage_ specifies the requested storage size for the PVC ("1Gi") ## Activities -| Task | Description | Link | -| --------------------------------| ------------------ |:----------- | -| *** Try It Yourself *** | | +| Task | Description | Link | +| ----------------------------- | ------------------------------------------------------------ | :-------------------------------------------------------------------- | +| **_Try It Yourself_** | | | Setting up Persistent Volumes | Create a Persistent Volume that's accessible from a SQL Pod. | [Setting up Persistent Volumes](../../labs/kubernetes/lab10/index.md) | - diff --git a/docs/openshift/state-persistence/pv-pvc.md b/docs/openshift/state-persistence/pv-pvc.md index 9aefec3..5e249ea 100644 --- a/docs/openshift/state-persistence/pv-pvc.md +++ b/docs/openshift/state-persistence/pv-pvc.md @@ -12,24 +12,23 @@ Pods access storage by using the claim as a volume. Claims must exist in the sam PersistentVolumes binds are exclusive, and since PersistentVolumeClaims are namespaced objects, mounting claims with “Many” modes (ROX, RWX) is only possible within one namespace. - - ## Resources + === "OpenShift" - [Persistent Storage :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html){ .md-button target="_blank"} + [Persistent Storage :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html){ .md-button target="_blank"} - [Persistent Volume Types :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#types-of-persistent-volumes_understanding-persistent-storage){ .md-button target="_blank"} + [Persistent Volume Types :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#types-of-persistent-volumes_understanding-persistent-storage){ .md-button target="_blank"} - [Expanding Peristent Volumes :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/expanding-persistent-volumes.html){ .md-button target="_blank"} + [Expanding Peristent Volumes :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/expanding-persistent-volumes.html){ .md-button target="_blank"} === "Kubernetes" - [Persistent Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"} + [Persistent Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/){ .md-button target="_blank"} - [Writing Portable Configurations :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#writing-portable-configuration){ .md-button target="_blank"} + [Writing Portable Configurations :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/persistent-volumes/#writing-portable-configuration){ .md-button target="_blank"} - [Configuring Persistent Volume Storage :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/){ .md-button target="_blank"} + [Configuring Persistent Volume Storage :fontawesome-solid-database:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/){ .md-button target="_blank"} ## References @@ -69,16 +68,21 @@ metadata: name: my-pod spec: containers: - - name: nginx - image: busybox - command: ['sh', '-c', 'echo $(date):$HOSTNAME Hello Kubernetes! >> /mnt/data/message.txt && sleep 3600'] - volumeMounts: - - mountPath: "/mnt/data" - name: my-data + - name: nginx + image: busybox + command: + [ + "sh", + "-c", + "echo $(date):$HOSTNAME Hello Kubernetes! >> /mnt/data/message.txt && sleep 3600", + ] + volumeMounts: + - mountPath: "/mnt/data" + name: my-data volumes: - - name: my-data - persistentVolumeClaim: - claimName: my-pvc + - name: my-data + persistentVolumeClaim: + claimName: my-pvc ``` === "OpenShift" @@ -103,4 +107,4 @@ spec: ``` Bash title="Get the Persistent Volume Claims" kubectl get pvc - ``` \ No newline at end of file + ``` diff --git a/docs/openshift/state-persistence/volumes.md b/docs/openshift/state-persistence/volumes.md index 086aafa..a64b8a2 100644 --- a/docs/openshift/state-persistence/volumes.md +++ b/docs/openshift/state-persistence/volumes.md @@ -10,12 +10,11 @@ A Kubernetes volume, on the other hand, has an explicit lifetime - the same as t === "OpenShift" - [Volume Lifecycle :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#lifecycle-volume-claim_understanding-persistent-storage){ .md-button target="_blank"} + [Volume Lifecycle :fontawesome-solid-database:](https://docs.openshift.com/container-platform/4.13/storage/understanding-persistent-storage.html#lifecycle-volume-claim_understanding-persistent-storage){ .md-button target="_blank"} === "Kubernetes" - [Volumes :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"} - + [Volumes :fontawesome-solid-database:](https://kubernetes.io/docs/concepts/storage/volumes/){ .md-button target="_blank"} ## References @@ -26,15 +25,15 @@ metadata: name: my-pod spec: containers: - - image: busybox - command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600'] - name: busybox - volumeMounts: - - mountPath: /cache - name: cache-volume + - image: busybox + command: ["sh", "-c", "echo Hello Kubernetes! && sleep 3600"] + name: busybox + volumeMounts: + - mountPath: /cache + name: cache-volume volumes: - - name: cache-volume - emptyDir: {} + - name: cache-volume + emptyDir: {} ``` ```yaml @@ -44,16 +43,16 @@ metadata: name: test-pd spec: containers: - - image: bitnami/nginx - name: test-container - volumeMounts: - - mountPath: /test-pd - name: test-volume + - image: bitnami/nginx + name: test-container + volumeMounts: + - mountPath: /test-pd + name: test-volume volumes: - - name: test-volume - hostPath: - # directory location on host - path: /data - # this field is optional - type: Directory -``` \ No newline at end of file + - name: test-volume + hostPath: + # directory location on host + path: /data + # this field is optional + type: Directory +```