https://pulumi.com logo
#general
Title
# general
m

miniature-potato-84713

02/06/2019, 10:22 PM
Kubernetes question on a local Mac machine. Is minikube the same as the Kubernetes cluster that now ships with Docker’s app? I mean, can I use Docker’s Kubernetes cluster as a drop-in replacement for minikube? I’m debugging a deployment error (a timeout when creating a
k8s.core.v1.Service()
) and wondering if there’s a problem linked to the
isMinikube
setting.
g

gorgeous-egg-16927

02/06/2019, 10:31 PM
No the Docker-for-Mac k8s cluster is not the same as Minikube. I mostly use DfM myself for development, but there are differences in what gets deployed by default
m

miniature-potato-84713

02/06/2019, 10:35 PM
Thanks @gorgeous-egg-16927. I keep getting timeout errors (with or without using
"ClusterIP"
when trying to allocate a local IP. For example with the Guestbook example code. Using the Docker for Mac k8s cluster. I’ll try minikube next.
c

creamy-potato-29402

02/06/2019, 10:43 PM
@miniature-potato-84713 in DfM they populate
hostname
instead of the IP in the
.status
gield
m

miniature-potato-84713

02/06/2019, 11:42 PM
Hmm, ok, I’ll poke around. (I’m just starting to learn all that stuff.) So you’re saying that I need to tailor the Pūlumi code to the Kubernetes flavor I write it for—minikube, DfM, ECS?
g

gorgeous-egg-16927

02/06/2019, 11:48 PM
Not generally, but perhaps for particular edge cases. If you have an example program that's not working, we can help troubleshoot
m

miniature-potato-84713

02/07/2019, 12:06 AM
@gorgeous-egg-16927, The Guestbook example from your example repo…
c

creamy-potato-29402

02/07/2019, 12:46 AM
@miniature-potato-84713 oh sorry I missed the actual quesiton.
Yes, if you’re running minikube or DfM you need to set
isMinikube
to true.
otherwise it will wait for a load balancer to be provisioned, which presumably your local machine cannot do. 🙂
m

miniature-potato-84713

02/07/2019, 12:49 AM
@creamy-potato-29402, that’s what I thought but I still get the timeout.
c

creamy-potato-29402

02/07/2019, 12:49 AM
can you post the code?
m

miniature-potato-84713

02/07/2019, 12:50 AM
c

creamy-potato-29402

02/07/2019, 12:50 AM
oh lol someone changed the code and didn’t update the docs
oh wait….
let me try it.
m

miniature-potato-84713

02/07/2019, 12:54 AM
Ok
c

creamy-potato-29402

02/07/2019, 12:54 AM
@miniature-potato-84713 it is the frontend service that’s failing, right?
m

miniature-potato-84713

02/07/2019, 12:54 AM
Yes.
c

creamy-potato-29402

02/07/2019, 12:54 AM
Copy code
$ minikube start
There is a newer version of minikube available (v0.33.1).  Download it here:
<https://github.com/kubernetes/minikube/releases/tag/v0.33.1>

To disable this notification, run the following:
minikube config set WantUpdateNotification false
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
E0206 16:54:35.569372   74404 start.go:174] Error starting host: Error starting stopped host: Error setting up host only network on machine start: host-only cidr conflicts with the network address of a host interface.

 Retrying.
E0206 16:54:35.569881   74404 start.go:180] Error starting host:  Error starting stopped host: Error setting up host only network on machine start: host-only cidr conflicts with the network address of a host interface
ugh
computers were a mistake.
👍 1
m

miniature-potato-84713

02/07/2019, 12:55 AM
Have you tried it with Kubernetes that runs in Docker for Mac?
c

creamy-potato-29402

02/07/2019, 12:57 AM
I’ve never tried dfm
installing
@miniature-potato-84713 in the meantime, can you show me what the result of
kubectl get
is?
for htat object
m

miniature-potato-84713

02/07/2019, 1:01 AM
One moment, let me
up
first
@creamy-potato-29402, still noodling… waiting for the timeout
As for
get
which resource type do you want?
c

creamy-potato-29402

02/07/2019, 1:11 AM
the service
hmm this worked for me.
m

miniature-potato-84713

02/07/2019, 1:11 AM
Currently
Copy code
frontend-aqczm1da        LoadBalancer   10.98.147.145   <pending>     80:32229/TCP   9m
Wait
Loadbalancer?
Let me try again.
guestbook:isMinikube: "true"
c

creamy-potato-29402

02/07/2019, 1:12 AM
is that the name of your stack?
pulumi stack ls
what platform are you on
m

miniature-potato-84713

02/07/2019, 1:13 AM
Mac
c

creamy-potato-29402

02/07/2019, 1:13 AM
oh duh lol sorry
Yeah this works both ways for me
m

miniature-potato-84713

02/07/2019, 1:16 AM
up
again, making sure that the config says it’s a minikube (i.e. don’t use the load balancer). But you mentioned earlier the
in DfM they populate
hostname
instead of the IP in the
.status
gield
which would mean that I shouldn’t use
"clusterIP"
, correct?
c

creamy-potato-29402

02/07/2019, 1:16 AM
this shouldn’t affect you, if you’re timing out
isMinikube
should only decide whether the service should be type clusterIP or not
can you run
pulumi config set isMinikube true
and then
pulumi config
and tell me the output?
m

miniature-potato-84713

02/07/2019, 1:18 AM
Copy code
KEY                   VALUE
guestbook:isMinikube  true
That’s what’s noodling right now through
pulumi up
c

creamy-potato-29402

02/07/2019, 1:18 AM
Right, I just want to confirm that your stack is actually called
guestbook
that’s after you ran exactly that command, right?
m

miniature-potato-84713

02/07/2019, 1:18 AM
Yeah 😉
Copy code
pulumi-examples/kubernetes-ts-guestbook/components > pulumi config
KEY                   VALUE
guestbook:isMinikube  true
c

creamy-potato-29402

02/07/2019, 1:19 AM
ok, so when you
get -o yaml
the service object you’re waiting on, what does it show?
m

miniature-potato-84713

02/07/2019, 1:21 AM
Copy code
> kubectl get services
NAME                     TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
frontend-cjxb1rpy        LoadBalancer   10.105.151.196   <pending>     80:32503/TCP   6m
redis-master-7w2eedl3    ClusterIP      10.102.106.173   <none>        6379/TCP       6m
redis-replica-wo7gjc3z   ClusterIP      10.101.191.1     <none>        6379/TCP       6m
Again with the LB
c

creamy-potato-29402

02/07/2019, 1:21 AM
wtf
m

miniature-potato-84713

02/07/2019, 1:22 AM
Copy code
> kubectl get service frontend-cjxb1rpy -o yaml
apiVersion: v1
kind: Service
metadata:
  annotations:
    <http://pulumi.com/autonamed|pulumi.com/autonamed>: "true"
  creationTimestamp: 2019-02-07T01:13:25Z
  name: frontend-cjxb1rpy
  namespace: default
  resourceVersion: "80631"
  selfLink: /api/v1/namespaces/default/services/frontend-cjxb1rpy
  uid: 91d0f047-2a75-11e9-a4f9-025000000001
spec:
  clusterIP: 10.105.151.196
  externalTrafficPolicy: Cluster
  ports:
  - nodePort: 32503
    port: 80
    protocol: TCP
    targetPort: 80
  selector:
    app: frontend
  sessionAffinity: None
  type: LoadBalancer
status:
  loadBalancer: {}
c

creamy-potato-29402

02/07/2019, 1:22 AM
can you change it to:
Copy code
let frontend = new k8sjs.ServiceDeployment("frontend", {
    replicas: 3,
    image: "<http://gcr.io/google-samples/gb-frontend:v4|gcr.io/google-samples/gb-frontend:v4>",
    ports: [80],
    allocateIpAddress: true,
    isMinikube: true
});
just to be sure
I like JUST tried this, this should def. work.
m

miniature-potato-84713

02/07/2019, 1:22 AM
Destroy the current stack?
c

creamy-potato-29402

02/07/2019, 1:23 AM
nah, just change that one thing
just copy+paste into the file.
m

miniature-potato-84713

02/07/2019, 1:23 AM
Ok, one moment. The
up
is still noodling…
Or should I ctrl-c it?
Oh
Done 🙂
c

creamy-potato-29402

02/07/2019, 1:23 AM
do that
m

miniature-potato-84713

02/07/2019, 1:23 AM
One moment
c

creamy-potato-29402

02/07/2019, 1:23 AM
k8s provider is really good at recovering
not all the providers do, the AWS provider for example makes you wait.
k8s will just quite immediately.
m

miniature-potato-84713

02/07/2019, 1:24 AM
Ok, changed to hardwired minikube…
up
again…
Worked like a charm.
Copy code
Outputs:
  + frontendIp: "10.99.213.188"

Resources:
    +-1 replaced
    9 unchanged

Duration: 15s
c

creamy-potato-29402

02/07/2019, 1:25 AM
ok so
isMinikube
is set incorrectly
pulumi config set isMinikube true
is not the same thing as
pulumi config set guestbook:isMinikube true
I’m guessing your stack is not called
guestbook
m

miniature-potato-84713

02/07/2019, 1:26 AM
ARGH!
c

creamy-potato-29402

02/07/2019, 1:27 AM
pulumi stack ls
m

miniature-potato-84713

02/07/2019, 1:27 AM
testbook
vs
guestbook
Let me check the docs.
c

creamy-potato-29402

02/07/2019, 1:27 AM
lol
welp.
m

miniature-potato-84713

02/07/2019, 1:27 AM
pulumi config
KEY VALUE guestbook:isMinikube true
pulumi stack ls
NAME LAST UPDATE RESOURCE COUNT URL testbook* 1 minute ago 11 https://app.pulumi.com/jenstroeger/guestbook-easy/testbook
c

creamy-potato-29402

02/07/2019, 1:27 AM
lol that would do it
m

miniature-potato-84713

02/07/2019, 1:28 AM
HAH!
Docs 😛
Copy code
$ pulumi stack init
Enter a stack name: testbook
and then
Copy code
pulumi config set guestbook:isMinikube <value>
Should I submit a PR?
c

creamy-potato-29402

02/07/2019, 1:29 AM
that would be great.
m

miniature-potato-84713

02/07/2019, 1:29 AM
And then
Copy code
$ pulumi up
Updating stack 'k8sjs-guestbook'
...
Yeah I think that’s a bit inconsistent here 😉
c

creamy-potato-29402

02/07/2019, 1:29 AM
yeah that’s our bad
someday we will automate the docs.
m

miniature-potato-84713

02/07/2019, 1:30 AM
Phew!
Great to have a scapegoat that’s not me.
c

creamy-potato-29402

02/07/2019, 1:30 AM
When in doubt, blame the CEO. 😉 who just so happens to have written this example.
m

miniature-potato-84713

02/07/2019, 1:34 AM
Well thanks @big-piano-35669. I think you owe me a cookie next time I’m in town 😄 @creamy-potato-29402, should I update the
up
output as well?
c

creamy-potato-29402

02/07/2019, 1:38 AM
to the readme?
Sure, if you like
m

miniature-potato-84713

02/07/2019, 1:39 AM
Yes. I’m running the example front-to-back (well, trying to) and the output has changed since the README was written.
@creamy-potato-29402 Could it be that it should be
Copy code
let config = new pulumi.Config("guestbook");
c

creamy-potato-29402

02/07/2019, 1:51 AM
nah
you want it to be the name of the stack
m

miniature-potato-84713

02/07/2019, 1:51 AM
Because I had the same issue
c

creamy-potato-29402

02/07/2019, 1:52 AM
pulumi config set isMinikube true
will set it to true independent of what your stack is called.
oh?
m

miniature-potato-84713

02/07/2019, 1:52 AM
Copy code
> pulumi config
KEY                   VALUE
guestbook:isMinikube  true
> pulumi stack ls
NAME        LAST UPDATE  RESOURCE COUNT  URL
guestbook*  in progress  10              <https://app.pulumi.com/jenstroeger/guestbook-easy/guestbook>
c

creamy-potato-29402

02/07/2019, 1:53 AM
can you try the command above and see what happens?
m

miniature-potato-84713

02/07/2019, 1:54 AM
This is getting more confusing now… where does the
guestbook-easy
come from?
c

creamy-potato-29402

02/07/2019, 1:54 AM
uh
I confess that I do not know.
m

miniature-potato-84713

02/07/2019, 1:55 AM
Copy code
>  pulumi stack init
Enter a stack name: guestbook
Created stack 'guestbook'

> pulumi config set guestbook:isMinikube true

> pulumi up
Previewing update (guestbook):

     Type                                Name                      Plan
 +   pulumi:pulumi:Stack                 guestbook-easy-guestbook  create
Huh?
c

creamy-potato-29402

02/07/2019, 1:56 AM
don’t know.
sorry
I would like to see what happens if you omit the
guestbook:
from the
pulumi config set
m

miniature-potato-84713

02/07/2019, 1:56 AM
Copy code
> cat Pulumi.yaml 
name: guestbook-easy
runtime: nodejs
description: Kubernetes Guestbook example based on <https://kubernetes.io/docs/tutorials/stateless-application/guestbook/>
template:
  config:
    isMinikube:
      description: Whether you are deploying to minikube
      default: true
c

creamy-potato-29402

02/07/2019, 1:57 AM
must be the name of the app
m

miniature-potato-84713

02/07/2019, 2:06 AM
You’ll see the problem in the diff. Thank you for your help!
Although I can’t open that
10.105.48.30
but maybe I don’t care right now.
c

creamy-potato-29402

02/07/2019, 2:38 AM
@miniature-potato-84713 that’s because it’s a cluster-internal IP address, isn’;t it?
m

miniature-potato-84713

02/07/2019, 3:45 AM
Yup, but the example is somewhat incomplete in that it doesn’t expose that IP.
c

creamy-potato-29402

02/07/2019, 3:45 AM
hmm, sorry, I’m confused. if the service is type clusterIP then it should NEVER expose a public IP, no?
m

miniature-potato-84713

02/07/2019, 3:46 AM
Yeah sorry.
What I mean is that the example doesn’t show how to get from that cluster to the website shown in the picture. I think earlier today I ran through similar examples and used
kubectl proxy
c

creamy-potato-29402

02/07/2019, 3:47 AM
that’s true.
m

miniature-potato-84713

02/07/2019, 3:49 AM
So I am not sure if that can be added to the Pulumi program, or can only be done from `kubectl`… (You’ve noticed: I’m learning, this is all new to me.)
c

creamy-potato-29402

02/07/2019, 3:49 AM
it kind of can!
this example will gate a multi-stage rollout on prometheus checks.
for local dev it does port forwarding.
this is NOT what you want to do in prod but you get the point.
m

miniature-potato-84713

02/07/2019, 3:51 AM
Ah yes 👍
I am so out of my league here 😄
c

creamy-potato-29402

02/07/2019, 3:52 AM
in fairness this “league” was made up like a couple months ago lol
so who is in the league, exactly
m

miniature-potato-84713

02/07/2019, 3:54 AM
You guys more so than I am, that’s for sure. I usually operate more in the OS/compiler guts than in these lofty heights of the stack… getting dizzy here from the view and thin air. Hey, is this the same prometheus we’re talking about? https://dramatiq.io/advanced.html#prometheus-metrics
c

creamy-potato-29402

02/07/2019, 3:55 AM
yes.
m

miniature-potato-84713

02/07/2019, 3:55 AM
Huh neat.
c

creamy-potato-29402

02/07/2019, 4:02 AM
yeah this is really stretching the possibilities.
4 Views