Skip to content

Commit 1970f6f

Browse files
Bharath KaimalBharath Kaimal
authored andcommitted
updates to kubernetes-configuration
1 parent 640e854 commit 1970f6f

File tree

3 files changed

+73
-68
lines changed

3 files changed

+73
-68
lines changed

docs/openshift/configuration/index.md

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ When you create a Pod, you can define a command and arguments for the containers
66

77
The command and arguments that you define in the configuration file override the default command and arguments provided by the container image
88

9-
Dockerfile vs Kubernetes
10-
Dockerfile Entrypoint -> k8s command
11-
Dockerfile CMD -> k8s args
9+
- Dockerfile vs Kubernetes
10+
- Dockerfile Entrypoint -> k8s command
11+
- Dockerfile CMD -> k8s args
1212

1313
### Ports
1414

@@ -24,11 +24,11 @@ A Pod can use environment variables to expose information about itself to Contai
2424

2525
=== "OpenShift & Kubernetes"
2626

27-
[Container Commands :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/){ .md-button target="_blank"}
27+
[Container Commands :fontawesome-solid-gear:](https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/){ .md-button target="_blank"}
2828

29-
[Environment Variables :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/){ .md-button target="_blank"}
29+
[Environment Variables :fontawesome-solid-gear:](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/){ .md-button target="_blank"}
3030

31-
[Pod Exposing :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#exposing-pods-to-the-cluster){ .md-button target="_blank"}
31+
[Pod Exposing :fontawesome-solid-gear:](https://kubernetes.io/docs/concepts/services-networking/connect-applications-service/#exposing-pods-to-the-cluster){ .md-button target="_blank"}
3232

3333
### References
3434

@@ -39,9 +39,9 @@ metadata:
3939
name: my-cmd-pod
4040
spec:
4141
containers:
42-
- name: myapp-container
43-
image: busybox
44-
command: ['echo']
42+
- name: myapp-container
43+
image: busybox
44+
command: ["echo"]
4545
restartPolicy: Never
4646
```
4747
@@ -52,10 +52,10 @@ metadata:
5252
name: my-arg-pod
5353
spec:
5454
containers:
55-
- name: myapp-container
56-
image: busybox
57-
command: ['echo']
58-
args: ['Hello World']
55+
- name: myapp-container
56+
image: busybox
57+
command: ["echo"]
58+
args: ["Hello World"]
5959
restartPolicy: Never
6060
```
6161
@@ -66,10 +66,10 @@ metadata:
6666
name: my-port-pod
6767
spec:
6868
containers:
69-
- name: myapp-container
70-
image: bitnami/nginx
71-
ports:
72-
- containerPort: 8080
69+
- name: myapp-container
70+
image: bitnami/nginx
71+
ports:
72+
- containerPort: 8080
7373
```
7474
7575
```yaml
@@ -80,13 +80,13 @@ metadata:
8080
spec:
8181
restartPolicy: Never
8282
containers:
83-
- name: c
84-
image: busybox
85-
env:
86-
- name: DEMO_GREETING
87-
value: "Hello from the environment"
88-
command: ["echo"]
89-
args: ["$(DEMO_GREETING)"]
83+
- name: c
84+
image: busybox
85+
env:
86+
- name: DEMO_GREETING
87+
value: "Hello from the environment"
88+
command: ["echo"]
89+
args: ["$(DEMO_GREETING)"]
9090
```
9191
9292
```yaml
@@ -131,9 +131,9 @@ CPU and memory are each a resource type. A resource type has a base unit. CPU is
131131
132132
=== "OpenShift & Kubernetes"
133133
134-
[Compute Resources :fontawesome-solid-globe:](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container){ .md-button target="_blank"}
134+
[Compute Resources :fontawesome-solid-screwdriver-wrench:](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container){ .md-button target="_blank"}
135135
136-
[Memory Management :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/){ .md-button target="_blank"}
136+
[Memory Management :fontawesome-solid-screwdriver-wrench:](https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/memory-default-namespace/){ .md-button target="_blank"}
137137
138138
### References
139139
@@ -144,53 +144,54 @@ metadata:
144144
name: my-pod
145145
spec:
146146
containers:
147-
- name: my-app
148-
image: bitnami/nginx
149-
ports:
150-
- containerPort: 8080
151-
resources:
152-
requests:
153-
memory: "64Mi"
154-
cpu: "250m"
155-
limits:
156-
memory: "128Mi"
157-
cpu: "500m"
147+
- name: my-app
148+
image: bitnami/nginx
149+
ports:
150+
- containerPort: 8080
151+
resources:
152+
requests:
153+
memory: "64Mi"
154+
cpu: "250m"
155+
limits:
156+
memory: "128Mi"
157+
cpu: "500m"
158158
```
159159
160+
_Namespaced defaults mem_
160161
161-
Namespaced defaults mem
162162
```yaml
163163
apiVersion: v1
164164
kind: LimitRange
165165
metadata:
166166
name: mem-limit-range
167167
spec:
168168
limits:
169-
- default:
170-
memory: 512Mi
171-
defaultRequest:
172-
memory: 256Mi
173-
type: Container
169+
- default:
170+
memory: 512Mi
171+
defaultRequest:
172+
memory: 256Mi
173+
type: Container
174174
```
175175
176-
Namespaced defaults mem
176+
_Namespaced defaults mem_
177+
177178
```yaml
178179
apiVersion: v1
179180
kind: LimitRange
180181
metadata:
181182
name: cpu-limit-range
182183
spec:
183184
limits:
184-
- default:
185-
cpu: 1
186-
defaultRequest:
187-
cpu: 0.5
188-
type: Container
185+
- default:
186+
cpu: 1
187+
defaultRequest:
188+
cpu: 0.5
189+
type: Container
189190
```
190191
191192
## Activities
192193
193-
| Task | Description | Link |
194-
| --------------------------------| ------------------ |:----------- |
195-
| *** Try It Yourself *** | | |
196-
| Pod Configuration | Configure a pod to meet compute resource requirements. | [Pod Configuration](../../labs/kubernetes/lab2/index.md) |
194+
| Task | Description | Link |
195+
| --------------------- | ------------------------------------------------------ | :------------------------------------------------------- |
196+
| **_Try It Yourself_** | | |
197+
| Pod Configuration | Configure a pod to meet compute resource requirements. | [Pod Configuration](../../labs/kubernetes/lab2/index.md) |

docs/openshift/configuration/security-contexts/index.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,24 @@ To specify security settings for a Pod, include the securityContext field in the
88

99
=== "OpenShift"
1010

11-
[Managing Security Contexts :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/authentication/managing-security-context-constraints.html){ .md-button target="_blank"}
11+
[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"}
1212

1313
=== "Kubernetes"
1414

15-
[Security Contexts :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/){ .md-button target="_blank"}
16-
15+
[Security Contexts :fontawesome-solid-shield-halved:](https://kubernetes.io/docs/tasks/configure-pod-container/security-context/){ .md-button target="_blank"}
1716

1817
## References
1918

2019
Setup minikube VM with users
20+
2121
```
2222
minikube ssh
2323
```
24+
2425
```
2526
su -
2627
```
28+
2729
```
2830
echo "container-user-0:x:2000:2000:-:/home/container-user-0:/bin/bash" >> /etc/passwd
2931
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
3537
chmod 640 /etc/message/message.txt
3638
```
3739

38-
3940
Using the this `securityContext` the container will be able to read the file `/message/message.txt`
41+
4042
```yaml
4143
apiVersion: v1
4244
kind: Pod
@@ -62,6 +64,7 @@ spec:
6264
```
6365
6466
Using the this `securityContext` the container should NOT be able to read the file `/message/message.txt`
67+
6568
```yaml
6669
apiVersion: v1
6770
kind: Pod
@@ -85,7 +88,8 @@ spec:
8588
hostPath:
8689
path: /etc/message
8790
```
88-
** Run to see the errors **
91+
92+
**Run to see the errors**
8993

9094
=== "OpenShift"
9195

@@ -105,4 +109,4 @@ spec:
105109

106110
``` Bash title="Should return"
107111
cat: can't open '/message/message.txt': Permission denied
108-
```
112+
```

docs/openshift/configuration/service-accounts/index.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ User accounts are intended to be global. Names must be unique across all namespa
1212

1313
=== "OpenShift"
1414

15-
[Service Accounts :fontawesome-solid-globe:](https://docs.openshift.com/container-platform/4.13/authentication/understanding-and-creating-service-accounts.html){ .md-button target="_blank"}
15+
[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"}
1616

17-
[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"}
17+
[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"}
1818

1919
=== "Kubernetes"
2020

21-
[Service Accounts :fontawesome-solid-globe:](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/){ .md-button target="_blank"}
21+
[Service Accounts :fontawesome-solid-id-card:](https://kubernetes.io/docs/reference/access-authn-authz/service-accounts-admin/){ .md-button target="_blank"}
2222

23-
[Service Account Configuration :fontawesome-solid-globe:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/){ .md-button target="_blank"}
23+
[Service Account Configuration :fontawesome-solid-id-card:](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/){ .md-button target="_blank"}
2424

2525
## References
2626

@@ -39,10 +39,10 @@ metadata:
3939
spec:
4040
serviceAccountName: my-service-account
4141
containers:
42-
- name: my-app
43-
image: bitnami/nginx
44-
ports:
45-
- containerPort: 8080
42+
- name: my-app
43+
image: bitnami/nginx
44+
ports:
45+
- containerPort: 8080
4646
```
4747
4848
```yaml
@@ -73,4 +73,4 @@ type: kubernetes.io/service-account-token
7373

7474
``` Bash title="View Service Account Details"
7575
kubectl describe sa <service_account_name>
76-
```
76+
```

0 commit comments

Comments
 (0)