Created
February 27, 2020 19:54
-
-
Save adamreese/aaaf11a3668d718e44d895779113f43c to your computer and use it in GitHub Desktop.
Kubernetes resource apiVersion issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -euo pipefail | |
echo "creating a apps/v1 deployment" | |
echo | |
cat <<EOF | kubectl create -f - | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: nginx-deployment | |
spec: | |
selector: | |
matchLabels: | |
app: nginx | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: nginx | |
spec: | |
containers: | |
- name: nginx | |
image: nginx:1.7.9 | |
ports: | |
- containerPort: 80 | |
EOF | |
api_version_create=$(kubectl get deployment nginx-deployment --template='{{.apiVersion}}') | |
echo | |
echo "actual apiVersion created: $api_version_create" |
$ kubectl get deployments.apps nginx-deployment --template='{{.apiVersion}}'
apps/v1
$ kubectl get deployments.extensions nginx-deployment --template='{{.apiVersion}}'
extensions/v1beta1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output on a v1.15 cluster