Skip to content

Instantly share code, notes, and snippets.

@relaxdiego
Created July 25, 2020 11:18
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 relaxdiego/0ef69eac8268bd0a09b206857a4545a3 to your computer and use it in GitHub Desktop.
Save relaxdiego/0ef69eac8268bd0a09b206857a4545a3 to your computer and use it in GitHub Desktop.
Tried the raw-k8s-spec feature flag. Did not work 😿
# Set up system. There's a problem with Juju 2.8.1 and microk8s 1.18
# So we trick Juju 2.8.1 into thinking it's just connecting to a
# regular kubernetes cluster
sudo snap remove microk8s
sudo snap refresh --channel=2.8/stable juju --classic
sudo snap install --channel=1.18/stable microk8s --classic
sudo snap install --channel=1.18/stable kubectl --classic
sudo microk8s.config > ~/.kube/config
juju add-k8s k8s-1.18 --storage=hostpath
# And we're off to the races!
export JUJU_DEV_FEATURE_FLAGS=raw-k8s-spec
export JUJU_FEATURES=raw-k8s-spec
juju bootstrap k8s-1.18 juju-2-8-1
juju add-model demo
juju deploy ./doperator.charm --resource doperator-image=grafana/grafana:latest # Built from https://github.com/relaxdiego/doperator
juju exec --application doperator -- status-set active
kubectl exec -it doperator-operator-0 -- /bin/bash
cat >rc.yaml<<EOF
kind: ReplicationController
apiVersion: v1beta3
metadata:
name: frontend-v2
labels:
name: frontend
group: kubersample
spec:
replicas: 4
selector:
name: frontend
version: v2
group: kubersample
template:
metadata:
labels:
name: frontend
version: v2
group: kubersample
spec:
containers:
- name: kubersample
image: relaxdiego/kubersample:v2
command:
- /usr/local/bin/ruby
- /usr/share/kubersample/app.rb
ports:
- containerPort: 4567
name: app
protocol: TCP
EOF
exit
juju exec --application doperator -- k8s-raw-set --file /var/lib/juju/rc.yaml
juju debug-log
# Clean up
juju destroy-model --destroy-storage --force demo
juju destroy-controller --destroy-storage juju-2-8-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment