Skip to content

Commit

Permalink
Merge pull request #2 from ibm-cloud-architecture/bck-updates
Browse files Browse the repository at this point in the history
Bck updates
  • Loading branch information
bkribbs15 authored Jul 30, 2024
2 parents fa16589 + eb5c573 commit 33cf24a
Show file tree
Hide file tree
Showing 19 changed files with 504 additions and 507 deletions.
13 changes: 7 additions & 6 deletions docs/openshift/configuration/config-map/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -11,22 +12,22 @@ 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

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: my-cm
name: my-cm
data:
color: blue
location: naboo
color: blue
location: naboo
```
```yaml
Expand Down Expand Up @@ -89,4 +90,4 @@ spec:
- configMapRef:
name: my-cm
restartPolicy: Never
```
```
107 changes: 54 additions & 53 deletions docs/openshift/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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
```
Expand All @@ -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
```
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -144,53 +144,54 @@ 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
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
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) |
95 changes: 43 additions & 52 deletions docs/openshift/configuration/secrets/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -30,15 +29,15 @@ A Secret is an object that contains a small amount of sensitive data such as a p
</div>


[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

Expand Down Expand Up @@ -74,62 +73,54 @@ 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:
secretName: mysecret-config
```
=== "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
```
`
**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
`
Loading

0 comments on commit 33cf24a

Please sign in to comment.