Skip to content

Latest commit

 

History

History
149 lines (101 loc) · 2.63 KB

kubernetesBeyond.md

File metadata and controls

149 lines (101 loc) · 2.63 KB

Beyond Kubernetes fundamentals

Before start check your path.

cd files-beyond-kubernetes/

Ingress

minimal-ingress.yaml

Exposing a web server using Ingress

# Create a new deployment
kubectl create deployment my-webserver --image=nginxdemos/hello

# Create a service with a command
# The service listens on :8080, but the container (our app) does on :80
kubectl expose deployment/my-webserver --name my-webserver --port=8080 --target-port=80


# Not required, but just to check it works, let’s port-forward it temporarily
# The service listened on :8080, but we will port-forward it through the :7777
kubectl port-forward service/my-webserver 7777:8080

Go to: http://127.0.0.1:7777/

my-demo-ingress.yaml

kubectl apply -f my-demo-ingress.yaml
kubectl get ingress

Go to: http://localhost:8080

Persistence Volume Claim

my-pvc.yaml

kubectl apply -f my-pvc.yaml
kubectl get pvc

my-pod-pvc.yaml

kubectl apply -f my-pod-pvc.yaml

Job and CronJob

my-job.yaml

kubectl apply -f my-job.yaml
kubectl get jobs

my-cronjob.yaml

kubectl apply -f my-cronjob.yaml
kubectl get cronjobs
kubectl get job

InitContainers

my-pod-init.yaml

kubectl apply -f my-pod-init.yaml
kubectl get pods

ConfigMap

my-cm.yaml

kubectl apply -f my-cm.yaml

Equivalent:

kubectl create configmap mysql --from-literal=replication-mode=master --from-literal=replication-user=master

check:

kubectl get configmap mysql -o jsonpath='{.data}'

my-pod-cm-env.yaml

kubectl apply -f my-pod-cm-env.yaml

my-pod-cm-vol.yaml

kubectl apply -f my-pod-cm-vol.yaml

Secret

my-secret.yaml

kubectl apply -f my-secret.yaml

Equivalent:

kubectl create secret generic mysql --from-literal=password=root

Check:

kubectl get secret mysql -o go-template='{{.data.password | base64decode}}'

my-pod-secret.yaml

kubectl apply -f my-pod-secret.yaml