My end goal is to create a blue green deployment however I cannot find an example how I can implement a deployment file using this kind of template https://kubernetes.io/docs/concepts/workloads/controllers/deployment/ as when configuring istio for blue green deployment this is required. I have worked through lab1 and lab2 I have 2 vms(vm1, vm2) https://kubevirt.io/labs/kubernetes/lab1 after all the prerequisites/installtion/setup for kubeVirt
$ cat pvc_fedora.yml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: "fedora"
labels:
app: containerized-data-importer
annotations:
cdi.kubevirt.io/storage.import.endpoint: "https://download.fedoraproject.org/pub/fedora/linux/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.raw.xz"
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
I have the 2 VM's running. I can ssh into then and run webservice and access externally.
When I try to implement blue green deployment the same method that works for application in docker does not work for this. I have 5 manifests files deployment.yml gateway.yml route-test.yml route.yml service.yml
deployment.yaml
is taken from how to implement using an application https://semaphoreci.com/blog/continuous-blue-green-deployments-with-kubernetes . how can I change this to implement and deploy VM's
This is my basic file on how I deploy a VM
$ cat vm1_pvc.yml
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
creationTimestamp: 2018-07-04T15:03:08Z
generation: 1
labels:
kubevirt.io/os: linux
app: myapp
name: vm1
spec:
running: true
template:
metadata:
creationTimestamp: null
labels:
kubevirt.io/domain: vm1
app: myapp
spec:
domain:
cpu:
cores: 2
devices:
disks:
- disk:
bus: virtio
name: disk0
- cdrom:
bus: sata
readonly: true
name: cloudinitdisk
machine:
type: q35
resources:
requests:
memory: 1024M
volumes:
- name: disk0
persistentVolumeClaim:
claimName: fedora
- cloudInitNoCloud:
userData: |
#cloud-config
hostname: vm1
ssh_pwauth: True
disable_root: false
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDHk/Now0HNU4w21wP7KWjCUHgc9vmNP7n+5bbpF+OQAmFy5GVxLVgdUSR0xVLqwPgpiAbowGwm/E/j04uXrpPz6bb6CzIuPPjq6BhzQYVZqH9QsWksHzq7Q8d04d44ny71TcVl42ubjK7WaoqYgOv6fqF21wp3l/1D9NV2cz+k6Xgep7/lClmzoXY4NhSjIlwwr7ZePmOBl+lnj7AeSqzK34YM75Hapw+bqthYhNQW8zEseRfP0ET1iT58RLuMrKVImVw16gweRPM9jAyUUqkzh1u+/J4bInYI4ZjtKXjxuqUGdhHuatd+BgArE3RLlDUOrxfO0yyBPzZgXim/9BXPp+5ux0aDgsBK/B3uWxyuwLt3a+k+rjVmOTzjknuJc2l0VdQV4fK5gOm2f0kT7tSflX2Y3kj49MIMPijLGwT0ZYyBYOKJ2Yym8xOz4Y9BY32RG2Caln859sW+Wo4bd7RvxvZ+/ig5AZbybSXLYZC9cw7xl81BMYYuxqbxvpBK5yc= sytel@openstack
name: cloudinitdisk
The VM part is all working, active and running, but I want implement blue/green deployment for VM's
I have tried this file but it fails
# manifests/deployment.yml
apiVersion: apps/v1
kind: Deployment
metadata:
name: myapp-$COLOR_TEST
labels:
app: myapp
color: $COLOR_TEST
spec:
replicas: 1
selector:
matchLabels:
app: myapp
color: $COLOR_TEST
strategy:
type: Recreate
template:
metadata:
creationTimestamp: 2018-07-04T15:03:08Z
generation: 1
labels:
kubevirt.io/os: linux
app: myapp
name: vm1
spec:
running: true
template:
metadata:
creationTimestamp: null
labels:
kubevirt.io/domain: vm1
app: myapp
spec:
domain:
cpu:
cores: 2
devices:
disks:
- disk:
bus: virtio
name: disk0
- cdrom:
bus: sata
readonly: true
name: cloudinitdisk
machine:
type: q35
resources:
requests:
memory: 1024M
volumes:
- name: disk0
persistentVolumeClaim:
claimName: fedora
- cloudInitNoCloud:
userData: |
#cloud-config
hostname: vm1
ssh_pwauth: True
disable_root: false
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDHk/Now0HNU4w21wP7KWjCUHgc9vmNP7n+5bbpF+OQAmFy5GVxLVgdUSR0xVLqwPgpiAbowGwm/E/j04uXrpPz6bb6CzIuPPjq6BhzQYVZqH9QsWksHzq7Q8d04d44ny71TcVl42ubjK7WaoqYgOv6fqF21wp3l/1D9NV2cz+k6Xgep7/lClmzoXY4NhSjIlwwr7ZePmOBl+lnj7AeSqzK34YM75Hapw+bqthYhNQW8zEseRfP0ET1iT58RLuMrKVImVw16gweRPM9jAyUUqkzh1u+/J4bInYI4ZjtKXjxuqUGdhHuatd+BgArE3RLlDUOrxfO0yyBPzZgXim/9BXPp+5ux0aDgsBK/B3uWxyuwLt3a+k+rjVmOTzjknuJc2l0VdQV4fK5gOm2f0kT7tSflX2Y3kj49MIMPijLGwT0ZYyBYOKJ2Yym8xOz4Y9BY32RG2Caln859sW+Wo4bd7RvxvZ+/ig5AZbybSXLYZC9cw7xl81BMYYuxqbxvpBK5yc= sytel@openstack
name: cloudinitdisk
Fails with
$ kubectl apply -f deployment.yml
error: error validating "deployment.yml": error validating data: [ValidationError(Deployment.spec): unknown field "running" in io.k8s.api.apps.v1.DeploymentSpec, ValidationError(Deployment.spec.template.spec): unknown field "domain" in io.k8s.api.core.v1.PodSpec, ValidationError(Deployment.spec.template.spec.volumes[1]): unknown field "cloudInitNoCloud" in io.k8s.api.core.v1.Volume, ValidationError(Deployment.spec.template.spec): missing required field "containers" in io.k8s.api.core.v1.PodSpec, ValidationError(Deployment.spec): missing required field "selector" in io.k8s.api.apps.v1.DeploymentSpec]; if you choose to ignore these errors, turn validation off with --validate=false
I have come across this page but what I want to deploy is a disk image https://istio.io/latest/docs/examples/virtual-machines/ in this example it would be a fedora disk or replacing it with an ubuntu disk etc