# k apply -f /var/work/21/app-21.yaml
error: resource mapping not found for name: "app-21" namespace: "" from "/var/work/21/app-21.yaml": no matches for kind "Deployment" in version "extensions/v1beta1"
ensure CRDs are installed first
# k create deployment test --image nginx -o yaml --dry-run=client
apiVersion: apps/v1 # it is current version for deployment
kind: Deployment
metadata:
creationTimestamp: null
labels:
app: test
name: test
spec:
replicas: 1
selector:
matchLabels:
app: test
strategy: {}
template:
metadata:
creationTimestamp: null
labels:
app: test
spec:
containers:
- image: nginx
name: nginx
resources: {}
status: {}
# vim /var/work/21/app-21.yaml
apiVersion: apps/v1 # update it from extensions/v1beta1
kind: Deployment
metadata:
name: app-21
labels:
app: app-21
spec:
replicas: 3
selector:
matchLabels:
app: app-21
template:
metadata:
labels:
app: app-21
spec:
containers:
- name: ping-pong
image: viktoruj/ping_pong:alpine
ports:
- containerPort: 8080
k apply -f /var/work/21/app-21.yaml
k get po,deployment -l app=app-21