Skip to content

Latest commit

 

History

History

exercise-4

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Exercise - 4

Anytime a team needs to run a container on Kubernetes they will need to define a pod within which to run the container.

  • Create a YAML formatted pod manifest pod.yml to create a pod named app1 that runs a container named app1cont using image ifccncf/arg-output with these command line arguments: -lines 56 -F
  • Create the pod with the kubectl command using the YAML file created in the previous step
  • When the pod is running display summary data about the pod in JSON format using the kubectl command and redirect the output to a file named out1.json
  • All of the files you need to work with have been created, empty, for your convenience

Solution

Step 1

kubectl run app1 --image=lfccncf/arg-output --dry-run=client -o yaml
apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null    
  labels:
    run: app1
  name: app1
spec:
  containers:
  - image: lfccncf/arg-output
    name: app1
    resources: {}
  dnsPolicy: ClusterFirst    
  restartPolicy: Always      
status: {}

Step 2

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: null    
  labels:
    run: app1
  name: app1
spec:
  containers:
  - image: lfccncf/arg-output
    name: app1
    args: ["-lines", "56", "-F"]
kubectl create -f .\app1-pod.yaml  

Step 3

kubectl get po app1 -o json > app1.json