Skip to content

Instantly share code, notes, and snippets.

@joshy91
Created July 12, 2018 15:36
Show Gist options
  • Save joshy91/36fcbd919a8e43de8f0cfe7720f736b8 to your computer and use it in GitHub Desktop.
Save joshy91/36fcbd919a8e43de8f0cfe7720f736b8 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Create and describe an alpine and an nginx pod then delete pods
#Create and describe alpine pod
echo “apiVersion: v1
kind: Pod
metadata:
name: alpine
namespace: default
spec:
containers:
- name: alpine
image: alpine
command:
- sleep
- "3600"
imagePullPolicy: IfNotPresent
restartPolicy: Always” >> alpine-pod.yaml
kubectl create -f alpine-pod.yaml
kubectl describe pod alpine
#Create and describe nginx pod
echo “apiVersion: v1
kind: Pod
metadata:
name: nginx
namespace: default
spec:
containers:
- name: nginx
image: nginx
command:
- start
imagePullPolicy: IfNotPresent
restartPolicy: Always” >> nginx-pod.yaml
kubectl create -f nginx-pod.yaml
kubectl describe pod nginx
#Destroy pods
kubectl delete pod nginx
kubectl delete pod alpine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment