Skip to content

Instantly share code, notes, and snippets.

@allanlei
Created January 28, 2018 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allanlei/2c85d81e12d544ce3a9651c75aa577fb to your computer and use it in GitHub Desktop.
Save allanlei/2c85d81e12d544ce3a9651c75aa577fb to your computer and use it in GitHub Desktop.
Install kubectl into a Kubernetes Pod
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
volumes:
- name: kubectl
emptyDir: {}
initContainers:
- name: install-kubectl
image: allanlei/kubectl
volumeMounts:
- name: kubectl
mountPath: /data
command: ["cp", "/usr/local/bin/kubectl", "/data/kubectl"]
containers:
- name: redis
image: redis:4.0.7-alpine
command: ["redis-server"]
volumeMounts:
- name: kubectl
subPath: kubectl
mountPath: /usr/local/bin/kubectl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment