stefanprodan / faas-grafana

OpenFaaS Grafana
https://hub.docker.com/r/stefanprodan/faas-grafana/
MIT License
35 stars 22 forks source link

Update README.md #4

Open juandisay opened 3 years ago

juandisay commented 3 years ago

kubectl run --generator=deployment/apps.v1 is DEPRECATED and will be removed in a future version

fadams commented 3 years ago

@juandisay I was just bitten by this too. Seems to be related to breaking changes in k8s 1.18 - more info in the links below: https://alexellisuk.medium.com/kubernetes-1-18-broke-kubectl-run-heres-what-to-do-about-it-2a88e5fb389a https://medium.com/better-programming/kubernetes-tips-create-pods-with-imperative-commands-in-1-18-62ea6e1ceb32

In your suggested updates won't that create and expose a Pod rather than a Deployment, so it's not changing like-for-like and also as far as I can see the port info is missing.

I think that the ideal way to update would be with a kubectl create deployment but AIUI that is currently lacking support for flags like --port and I believe ATM the only way to create an equivalent of

kubectl -n openfaas run \
      --image=stefanprodan/faas-grafana:4.6.3 \
      --port=3000 \
      grafana

is with something like this:

kubectl -n openfaas apply -f - << _EOF_
apiVersion: apps/v1
kind: Deployment
metadata:
  name: grafana
  labels:
    app: grafana
spec:
  replicas: 1
  selector:
    matchLabels:
      app: grafana
  template:
    metadata:
      labels:
        app: grafana
    spec:
      containers:
      - name: grafana
        image: stefanprodan/faas-grafana:4.6.3
        ports:
        - containerPort: 3000
_EOF_

I think the above followed by the original kubectl -n openfaas expose deployment... should have the equivalent behaviour to the original README.