Skip to content

Instantly share code, notes, and snippets.

@Daniel-M
Created March 3, 2020 14:31
Show Gist options
  • Save Daniel-M/87f251c627e0643b821aa8d4e7e6cb11 to your computer and use it in GitHub Desktop.
Save Daniel-M/87f251c627e0643b821aa8d4e7e6cb11 to your computer and use it in GitHub Desktop.
Kubernetes Autocompletion for UltiSnips
snippet pod "kubernetes Pod"
apiVersion: v1
kind: Pod
metadata:
name: ${1:PodName}
namespace: ${2:Namespace}
labels:
${3:LabelName}: ${4:LabelValue}
spec:
containers:
- name: ${5:ContainerName}
image:${6:ImageName}
ports:
- name: http
containerPort: 80
protocol: TCP
snippet service "Kubernetes Service"
apiVersion: v1
kind: Service
metadata:
name: ${1:SvcName}
namespace: ${2:Namespace}
spec:
selector:
${3:LabelName}: ${4:LabelValue}
ports:
- protocol: TCP
port: 80
targetPort: ${5:TargetPort}
snippet deploy "Kubernetes Deployment"
apiVersion: apps/v1
kind: Deployment
metadata:
name: ${1:DeploymentName}
namespace: ${2:Namespace}
labels:
${3:LabelName}: ${4:LabelValue}
spec:
replicas: ${5:Replicas}
selector:
matchLabels:
${6:LabelName}: ${7:LabelValue}
template:
metadata:
labels:
${6:LabelName}: ${9:LabelValue}
spec:
containers:
- name: ${10:ContainerName}
image:${11:ContainerImage}
ports:
- containerPort: 80
snippet cronjob "Kubernetes CronJob"
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: ${1:CronjobName}
namespace: ${2:Namespace}
spec:
schedule: "*/1 * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: ${3:ContainerName}
image:${4:ImageName}
restartPolicy: OnFailure
snippet configmap "Kubernetes ConfigMap"
apiVersion: v1
kind: ConfigMap
metadata:
name: ${1:ConfigMapName}
namespace: ${2:Namespace}
data:
file.name: |
multiline contents
for this file.name
snippet secret "Kubernetes Secret"
apiVersion: v1
kind: Secret
metadata:
name: ${1:SecretName}
namespace: ${2:Namespace}
type: Opaque
data:
base64.key1: ${3:Base64String1}
base64.key2: ${4:Base64String2}
stringData:
my.variable: ${5:MyVariableString}
my.file: |-
Multiline contents for this
secret file
snippet loadbalancer "Kubernetes LoadBalancer"
apiVersion: v1
kind: Service
metadata:
name: ${1:LoadBalancerName}
namespace: ${2:Namespace}
spec:
selector:
app: ${3:MyApp}
type: LoadBalancer
ports:
- protocol: TCP
port: 80
targetPort: ${3:TargetPort}
clusterIP: ${4:ClusterIP}
snippet ingress "Kubernetes Ingress"
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: ${1:IngressName}
namespace: ${2:Namespace}
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
rules:
- host: foo.bar.com
http:
paths:
- path: /foo
backend:
serviceName: service1
servicePort: 4200
- path: /bar
backend:
serviceName: service2
servicePort: 8080
snippet job "Kubernetes Job"
apiVersion: batch/v1
kind: Job
metadata:
name: ${1:JobName}
namespace: ${2:Namespace}
spec:
template:
spec:
containers:
- name: ${3:ContainerName}
image: ${4:ImageName}
restartPolicy: Never
backoffLimit: 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment