Skip to content

Instantly share code, notes, and snippets.

@egeneralov
Created June 24, 2020 13:39
Show Gist options
  • Save egeneralov/af1b4c052065eafca5ca1e0d19b154b5 to your computer and use it in GitHub Desktop.
Save egeneralov/af1b4c052065eafca5ca1e0d19b154b5 to your computer and use it in GitHub Desktop.
kubectl -n backup delete job/kubespray
cat << EOF | kubectl apply -f -
apiVersion: batch/v1
kind: Job
metadata:
labels:
app: kubespray
name: kubespray
namespace: backup
spec:
backoffLimit: 1
completions: 1
parallelism: 1
template:
metadata:
labels:
app: kubespray
spec:
containers:
- command:
- /usr/bin/ansible-playbook
- -i
- /tmp/project-kubespray/inventory/project/inventory.ini
- cluster.yml
image: registry.gitlab.com/egeneralov/aio-bundle:a06acba5
name: kubespray
volumeMounts:
- mountPath: /root/.ssh/id_rsa
name: kubespray
subPath: id_rsa
- mountPath: /root/.ssh/config
name: kubespray
subPath: config
- mountPath: /tmp/project-kubespray
name: kubespray-files
workingDir: /tmp/project-kubespray
restartPolicy: Never
terminationGracePeriodSeconds: 30
volumes:
- configMap:
defaultMode: 384
items:
- key: id_rsa
path: id_rsa
- key: id_rsa.pub
path: id_rsa.pub
- key: config
path: config
name: backup
name: kubespray
- hostPath:
path: /tmp/project-kubespray
type: DirectoryOrCreate
name: kubespray-files
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment